Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk7 min

How to Fix Wicked PDF Generation Failures on Production Servers

Wicked PDF depends on a separate wkhtmltopdf process. Diagnose production failures by checking the deployed binary, permissions, temporary files, PDF asset paths, and renderer-specific behavior.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If Wicked PDF works locally but fails after deployment, check the deployed wkhtmltopdf executable first, then verify temporary-file access and the asset URLs in the PDF-specific HTML. Wicked PDF is a Rails wrapper; the renderer is a separate process with its own filesystem, network access, permissions, and version-specific behavior.

Understand what runs when Rails generates a PDF

Wicked PDF connects a Rails view to the external wkhtmltopdf command-line renderer. Installing the gem alone does not install or guarantee a usable renderer. The deployed application must be able to execute a compatible binary, and that process must be able to read the HTML’s stylesheets, scripts, images, and other resources.

As an Amazon Associate I earn from qualifying purchases.

That is why an HTML page that looks correct in a development browser can produce a failed or incomplete PDF in production: the browser and the renderer are different processes operating under different conditions. The Wicked PDF README states that the project has been verified with Ruby 2.2–3.2 and Rails 4–7.0. Treat that as the README’s stated verification range, not a guarantee for every newer version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix failures in a reliable order

  1. Verify the renderer inside the deployed environment

    Run the check from the same host, container image, or release environment that serves the PDF request—not just from a developer machine. Confirm that wkhtmltopdf exists, can be executed by the application user, and reports the expected version and architecture. Wicked PDF’s README explains the separate executable dependency and the installation requirements.

    wkhtmltopdf --version
    which wkhtmltopdf

    If the command is missing, install a build compatible with the production OS and architecture. The official downloads page lists platform-specific builds; do not assume a binary copied from a workstation will work in a container or on a different distribution.

  2. Point Wicked PDF at the actual binary

    If the executable is installed outside the service’s PATH, configure its real production path. The project documents exe_path in WickedPdf configuration.

    WickedPdf.configure do |config|
      config.exe_path = "/usr/local/bin/wkhtmltopdf"
    end

    Replace the example path with the path confirmed on the deployed host. Check that the application process—not merely your login shell—has permission to execute it.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Check temporary-directory access

    Wicked PDF uses temporary HTML and asset files before invoking the renderer, as described in its README. If logs report a write, path, or permission error, inspect the configured temporary directory and its permissions as the actual application user. A writable temporary directory on a laptop says nothing about the service user’s production permissions.

  4. Inspect the HTML and URLs used specifically for the PDF

    Look at the rendered HTML that Wicked PDF passes to the external process. Relative paths, browser-only assumptions, or asset URLs that Rails can resolve but the separate renderer cannot may leave the PDF without styling or images. Use the documented Wicked PDF stylesheet, image, and JavaScript helpers; for Webpacker applications, use the corresponding pack helpers. See the project’s usage documentation.

  5. Precompile the assets the PDF needs

    Production commonly disables runtime asset compilation with config.assets.compile = false. Confirm that every stylesheet, script, font, and image used by the PDF view has been compiled and deployed, and that the URL or file path in the generated HTML is one the renderer can load. Wicked PDF specifically recommends precompilation in its asset guidance.

    Rank #2
    Sale
    Adobe Acrobat 6 PDF For Dummies
    • Used Book in Good Condition
  6. Allow local-file access only when required

    Wicked PDF documents enable_local_file_access = true as a configuration option. The renderer’s CLI reference explains that local-file access allows a local input file to read other local files. Prefer correcting resource paths or narrowly allowing required locations with the renderer’s documented --allow option rather than enabling broad access as a default fix.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  7. Use renderer diagnostics for resource and JavaScript problems

    The wkhtmltopdf command reference documents logging levels, resource-load error handling, JavaScript debugging, a delay, and a window-status wait. These can help distinguish a failed asset request or incomplete JavaScript rendering from a Rails view error or process-launch failure. Check that the installed renderer build supports the option you intend to use; available options vary by version.

  8. Reproduce the problem under production conditions

    Compare the deployed environment with the one where PDF generation works: operating-system distribution, CPU architecture, shared libraries, fonts, outbound network access to remote assets, and process permissions. Test from the production image or host and with the same application user. The official download list covers particular platform and architecture combinations, not one universal binary.

Match the symptom to the likely cause

Symptom First checks What the evidence tells you
Bad wkhtmltopdf path or the command will not execute Confirm the binary is installed in the runtime serving the request, check execute permissions, and set exe_path to its real location. Wicked PDF requires a separate executable and exposes path configuration in its README.
The HTML route works but the PDF request errors Separate Rails template rendering from external process startup; inspect application logs and reproduce with the deployed executable. The renderer runs outside Rails, so successful HTML rendering does not establish that the command can launch or finish.
PDF output has no styles or images Inspect the generated PDF HTML’s asset URLs, use the relevant Wicked PDF or pack helpers, and verify precompiled assets are deployed. The renderer must resolve resources itself; the project’s asset guidance addresses helpers and production compilation.
A JavaScript-driven section is blank or incomplete Confirm JavaScript is enabled, inspect renderer logs, and try an appropriate delay or window-status wait. The CLI documents these controls, but their availability does not mean the renderer behaves like a modern browser.
Local assets fail, or a template seems to require broad file access Check the paths and whether a narrow allow-list is sufficient; assess the security impact before enabling local-file access. The CLI documents local-file access and --allow; the project warns against processing untrusted HTML.
A fix works on one server but not another Compare renderer version and build, OS and distribution, CPU architecture, dependencies, and permissions. The official download page lists platform-specific builds rather than a single build for all deployments.

Choose a renderer build with deployment and security in mind

The wkhtmltopdf downloads page identifies 0.12.6 as its stable series and gives June 11, 2020 as its release date. That is a dated release, not evidence that it is the right choice for every current deployment. Check the page’s platform support and assess whether the project’s maintenance and security posture suit your environment before selecting a build.

Wicked PDF’s README says the wkhtmltopdf-binary gem currently installs a 0.12.x version, and notes that option availability depends on renderer version. When an option appears ineffective, check the actual executable version rather than assuming the gem’s presence establishes the behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wicked PDF inherits the installed renderer’s capabilities and limitations. The command reference documents JavaScript controls and resource-loading behavior, but this does not establish that modern browser JavaScript or CSS will render identically. For a replacement, evaluate compatibility with existing Rails templates and CSS, JavaScript-dependent pages, support for your OS and architecture, handling of untrusted HTML, migration effort, and who will own the renderer operationally.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep untrusted HTML away from the renderer

The official wkhtmltopdf downloads page warns: “Do not use wkhtmltopdf with any untrusted HTML – be sure to sanitize any user-supplied HTML/JS, otherwise it can lead to complete takeover of the server it is running on!” Treat user-controlled HTML and JavaScript as dangerous input. Do not pass it into the renderer unless it has been sanitized and the execution environment is appropriately constrained. Because local-file access lets a local HTML file read other local files, avoid enabling it broadly as a troubleshooting shortcut.

Or skip the browser setup

For website screenshots rather than Rails HTML-to-PDF rendering, ScreenshotNeo is a website screenshot API and MCP server for developers. It does not replace Wicked PDF for generating a PDF from a Rails view. One GET request can return a website screenshot or PDF; the API accepts a URL, for example:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for parameters and options. Cookie banners, newsletter popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common errors and practical fixes

  • “Bad wkhtmltopdf path”: Verify the executable path inside the serving runtime, then set exe_path to that path and ensure the app user can execute it.
  • Permission denied or temporary-file errors: Check directory permissions and available temporary storage as the service user; do not rely on permissions from an interactive shell.
  • Missing styles, fonts, or images: Inspect the generated HTML, correct asset references, use the PDF helpers, and verify production precompilation and deployment.
  • JavaScript output is incomplete: Check JavaScript settings and renderer logs, then test a delay or window-status wait supported by the installed build. Do not assume this provides modern-browser parity.
  • Local files still cannot be read: Verify the referenced path and whether it is actually local to the renderer; if access is necessary, use the narrowest supported allowance instead of blanket access.
  • Different results across deployment targets: Compare binary version, build, platform, architecture, dependencies, fonts, network access, and service-user permissions.

Frequently Asked Questions

Does installing the Wicked PDF gem install wkhtmltopdf?

No. Wicked PDF is the Rails integration layer; the deployed runtime also needs an executable renderer.

Will wkhtmltopdf render a modern browser page exactly?

That is not established. Output depends on the installed build, and the documented JavaScript controls do not guarantee modern-browser parity.

Can I pass user-submitted HTML to wkhtmltopdf?

The project warns against untrusted HTML and JavaScript. Sanitize user-supplied content and constrain the execution environment before considering that use.

Quick Recap

SaleBestseller No. 2
Adobe Acrobat 6 PDF For Dummies
Adobe Acrobat 6 PDF For Dummies
Used Book in Good Condition
$13.00

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.