Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Configure KnpSnappyBundle in config/packages/knp_snappy.yaml. Give its PDF and image services the paths to the corresponding renderer executables—wkhtmltopdf and wkhtmltoimage—then put renderer flags in each service’s options array. Set a writable temporary directory or a process timeout at the top level only if your application needs values different from the defaults.
Start with the two renderer services
KnpSnappyBundle is the Symfony integration for Snappy, which invokes external rendering programs. The bundle configuration controls whether its PDF and image services are enabled, which executable each service invokes, and which options it passes to that renderer. It does not replace the renderer binaries: they must be present and executable in the environment where the Symfony application runs.
Create or edit config/packages/knp_snappy.yaml:
# config/packages/knp_snappy.yaml
knp_snappy:
pdf:
enabled: true
binary: /usr/local/bin/wkhtmltopdf
options: []
image:
enabled: true
binary: /usr/local/bin/wkhtmltoimage
options: []
These executable paths are examples, not universal locations. Replace them with the paths available to the PHP process in the actual runtime environment. A binary found in an interactive shell may not be available to PHP-FPM, a container, a worker, or a deployment account running with a different PATH.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware match| Service | Typical output task | Executable | Configuration to check |
|---|---|---|---|
pdf |
Generate PDF documents | wkhtmltopdf |
Its enabled state, executable path, and PDF-specific options |
image |
Generate images such as JPEGs | wkhtmltoimage |
Its enabled state, executable path, and image-specific options |
The two services are independent. Enable only the output type the application needs, or configure both with their own executable paths and options. An option suitable for one renderer is not automatically appropriate for the other; verify flags against the installed executable.
#1 Best Overall
Install and register the bundle
Add the bundle with Composer:
composer require knplabs/knp-snappy-bundle
In the standard Symfony Flex recipe workflow, Flex handles bundle registration. If the project does not use Flex, add the bundle to config/bundles.php:
return [
// ...
KnpBundleSnappyBundleKnpSnappyBundle::class => ['all' => true],
];
Keep the existing entries in that file when adding this line. Registration and configuration are separate tasks: the bundle must be registered, while the YAML file supplies the service settings.
Choose a binary path that works at runtime
Use an absolute path when practical so the service does not depend on a particular process PATH. The configured path must refer to the matching renderer: point pdf.binary at wkhtmltopdf, and image.binary at wkhtmltoimage. Also confirm the application’s operating-system user can execute it.
On Windows, the upstream bundle example uses quoted executable paths; paths containing spaces need quoting and escaping appropriate to YAML and the environment. For example, treat this as a format illustration and replace it with the real installation path:
knp_snappy:
pdf:
enabled: true
binary: "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"
options: []
Do not copy a path from a developer workstation into a production configuration unless the executable exists at that same path on the production host or inside the application container. When deployments use different locations, provide environment-appropriate configuration rather than assuming the path is shared.
Pass renderer flags through options
The options value is an array of renderer arguments. The Snappy wrapper documentation illustrates flags such as disabling JavaScript, suppressing backgrounds, allowing specified paths, setting cookies or POST data, adding a cover or table of contents, and choosing a cache directory. These are examples, not a promise that every installed renderer build supports the same behavior.
A YAML options example might look like this:
knp_snappy:
pdf:
enabled: true
binary: /usr/local/bin/wkhtmltopdf
options:
no-background: true
disable-javascript: true
image:
enabled: true
binary: /usr/local/bin/wkhtmltoimage
options: []
Use only flags that make sense for the output service and the installed binary. Consult that executable’s help output and version, then test the result with representative pages. Renderer options are passed to an external program; a spelling or value accepted by one release may not behave identically in another. Keep options narrowly scoped to the service that needs them instead of copying a long generic list into both sections.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Be deliberate with local-file access
Snappy’s documentation warns that wkhtmltopdf’s --enable-local-file-access can be dangerous when rendering untrusted HTML or JavaScript: local files or remote code execution may be exposed. Do not enable local-file access broadly just to make a template render. First establish which local resources are necessary, restrict what untrusted input can reach, and grant access only as deliberately as the renderer permits.
Rank #3
Rendering user-supplied markup deserves particular care. A URL or HTML string may contain references beyond the visible page, and enabling a permissive renderer setting can change what the process is able to read or request. Treat the renderer as a security boundary: validate and constrain inputs, avoid passing arbitrary user-controlled options, and do not assume a successful render is proof that access was safely limited.
Set temporary storage and process timeout when needed
By default, the bundle uses PHP’s sys_get_temp_dir() for temporary files. If that location is unsuitable for the application, set temporary_folder to another directory that exists and is writable by the application process. A Symfony cache subdirectory is one possible choice, provided the runtime user has the required permissions.
knp_snappy:
temporary_folder: "%kernel.cache_dir%/snappy"
process_timeout: 20
The value 20 above is an example timeout in seconds, not a generally recommended limit. Choose a value that fits the actual workload: complex pages may take longer to render than simple ones, while an excessively long process can tie up a worker when a page stalls. Ensure the chosen temporary directory is created or can be created by the application and has sufficient available space.
These are top-level bundle settings, distinct from each renderer’s options. Put temporary_folder and process_timeout under knp_snappy, alongside pdf and image, rather than nesting them into one renderer’s options list.
Rank #4
Use the configured services in Symfony
The bundle exposes the services knp_snappy.pdf and knp_snappy.image. The documented use cases include generating an output from a URL with generate(), generating from HTML with generateFromHtml(), and using response classes to return generated PDF or JPEG content from a controller.
For example, the service operation conceptually takes a source and an output destination:
$pdf = $container->get('knp_snappy.pdf');
$pdf->generate('https://example.com', '/path/to/output.pdf');
In an application using Symfony dependency injection, obtain the appropriate service through the project’s normal service-injection approach rather than reaching into the container from arbitrary code. The example uses a URL and a destination path; for HTML input, use the service’s generateFromHtml() method. The generated file path must be writable where the process runs.
For an HTTP response, use the bundle’s response classes as shown in its documentation rather than manually guessing response headers. Choose the PDF service for PDF output and the image service for image output, and confirm the requested format matches the renderer and the response being returned.
Best Value
Check compatibility before deployment
Compatibility involves more than the bundle alone: check the PHP version, Symfony FrameworkBundle version, KnpSnappyBundle, its Snappy dependency, and the renderer executable together. Packagist metadata reported KnpSnappyBundle v1.10.6, published on January 7, 2026, requiring PHP >=8.1, knplabs/knp-snappy ^1.4.3, and FrameworkBundle constraints ^5.1, ^6.0, ^7.0, or ^8.0. Those are version-specific registry details, not a guarantee for a project using another release. Check the current package registry and, most importantly, the versions resolved in the application’s lockfile before changing a production dependency.
The renderer also affects page compatibility. The bundle README cautions that JavaScript-rendered pages may run into problems because wkhtmltopdf is not fully compatible with ES6 APIs; polyfills may bridge some gaps. Do not assume a modern JavaScript-heavy page will render as it does in a current browser. Test the actual page, renderer build, and deployment environment, including pages that depend on client-side rendering.
Troubleshoot configuration and render failures
- Executable not found: verify the configured
binarypath on the runtime host or inside the container, and confirm the PHP process can execute that file. Check that the PDF service points to wkhtmltopdf and the image service to wkhtmltoimage. - Works locally, fails in production: compare operating system, executable location, runtime user, permissions, and environment. The application’s web or worker process may have a different PATH and filesystem view from your shell.
- Unknown or ineffective option: check the installed renderer’s version and help output. Confirm that the option belongs to the renderer handling the requested output, then test with a small reproducible page.
- Temporary-file or permission error: check the effective temporary directory, available disk space, and write access for the Symfony process user. If using
temporary_folder, ensure the configured location is writable. - Render exceeds the timeout: determine whether the page is slow, waiting on external assets, or relying on JavaScript the renderer cannot handle. Adjust
process_timeoutonly after identifying the workload; the documented example of 20 seconds is not a universal setting. - Page differs from a modern browser: test its JavaScript behavior with the installed wkhtmltopdf build. ES6 compatibility is not complete; consider whether the page needs a polyfill or whether the rendering method is suitable for the page.
- Local image or stylesheet does not load: verify how the resource is addressed and whether renderer access is intentionally permitted. Avoid solving the issue by enabling broad local-file access for untrusted content.
- Bundle services are unavailable: confirm the bundle is registered in the application and that the configuration is in the expected package file. In non-Flex projects, check the entry in
config/bundles.php.
When diagnosing a failure, change one variable at a time: first establish that the correct executable runs under the application user, then test a basic URL or HTML sample, then add options or application-specific content. This separates bundle configuration problems from renderer behavior and page-specific failures.
Recommended Free Tools
Or skip the browser setup
KnpSnappyBundle configures server-side PDF and image generation through wkhtmltopdf and wkhtmltoimage. If your actual task is simply to take a website screenshot through an API instead of installing and configuring a renderer, ScreenshotNeo is a separate option; it does not replace KnpSnappyBundle for Symfony-generated PDFs.
One GET request returns an image or PDF; see the ScreenshotNeo API documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
- Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; each step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status.
- An MCP server provides screenshot tools for Claude, Cursor, and other MCP clients.
- The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up free for 1,000 screenshots a month with no card.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Free tools Windows power users keep installed
One-click scans. No signup required.

