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

Most PDFKit runtime errors in Rails come from one of four things: Rails cannot execute wkhtmltopdf, the renderer cannot reach the page’s assets, it is waiting on a callback to a single-threaded Rails server, or the PDF response is sent with the wrong content type. Check the binary from the Rails process’s environment first, then work through the matching symptom below.

How PDFKit and wkhtmltopdf work together

PDFKit is a Ruby gem that turns HTML and CSS into PDFs by calling the separate wkhtmltopdf command-line program. The gem is the Rails-facing wrapper; it does not replace the executable. That distinction is important: a working gem installation does not prove that the Rails process can find or run the renderer. The PDFKit README describes its backend as wkhtmltopdf, which renders HTML using WebKit (PDFKit project README).

PDFKit can be integrated as Rails middleware, and its renderer location can be configured in config/initializers/pdfkit.rb. The README’s compatibility list names Ruby 2.5–3.1 and Rails 4.2, 5.2, 6.0, 6.1 and 7.0. Treat those as the versions covered by that documentation snapshot, not as a guarantee about newer releases; check the project documentation and your installed gem’s requirements before upgrading.

Start with the executable and Rails process

Run these checks in the same host or container, as the same user, and in the same environment that starts Rails or the worker generating the PDF. A command that works in your interactive shell may fail under systemd, Docker, Passenger or a background job because those processes can have a different PATH, permissions or filesystem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
  1. Locate the executable: run which wkhtmltopdf on Unix-like systems, or use the equivalent executable lookup for your platform. If it returns nothing, the binary is missing from that environment or its directory is not on PATH.

  2. Run it directly: wkhtmltopdf --version. If that fails, capture the command’s stderr and fix the executable-level problem before debugging PDFKit. A generic Ruby exception can conceal a missing library, incompatible binary or permission error.

  3. Confirm that the file is executable by the Rails process and built for the host operating system and CPU architecture. A binary copied from a developer machine may not run in a container or on a different architecture.

  4. Record the resolved absolute path and use it in the PDFKit initializer. Retest after restarting the Rails process so it loads the updated configuration.

    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.

Configure an explicit binary path

For example, if the executable is actually at /usr/local/bin/wkhtmltopdf, put this in config/initializers/pdfkit.rb:

PDFKit.configure do |config|
  config.wkhtmltopdf = '/usr/local/bin/wkhtmltopdf'
end

Replace the example path with the path found in the Rails runtime environment; do not assume that every operating system or deployment puts the binary in /usr/local/bin. PDFKit documents this setting in its README (PDFKit project README).

If the path is right but execution still fails, check the file’s ownership and execute permissions, and inspect stderr from a direct invocation as the service user. If Rails runs in a container, the executable must be installed or mounted inside the container that runs PDF generation; having it on the host is not enough.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Fix missing CSS, images or JavaScript

wkhtmltopdf renders in its own process. Relative asset references that work in a browser may not resolve from that process, particularly when the Rails app is not reachable at the address the renderer tries to use. PDFKit’s troubleshooting guidance calls for absolute file paths or complete URLs for images, CSS and JavaScript (PDFKit project README).

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

JavaScript-dependent pages can also be incomplete if the renderer captures before the page has finished changing. Confirm that the content exists in the HTML and is available to the renderer, and distinguish a timing problem from a failed asset request by inspecting the generated document and the renderer’s stderr.

Resolve hangs and timeouts in development

A common development deadlock occurs when wkhtmltopdf requests assets from the Rails app while the original Rails request is waiting for wkhtmltopdf to finish. With a single-thread server, the original request can occupy the only available execution slot, leaving the asset callback unable to run. PDFKit’s README describes this issue and gives running multiple Unicorn workers as an example solution (PDFKit project README).

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Use more than one available worker

Configure the development server so another worker can serve the asset requests while the PDF-generating request waits. The exact setting depends on the server and version you use; the relevant property is that a separate request can be processed concurrently. Restart the server and retry the PDF request.

Remove the callback dependency

Where practical, embed the required resources or make them available as local files so wkhtmltopdf does not need to call back into the development server. This avoids the specific callback deadlock, though it does not solve unrelated network, path or rendering problems.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Tell a deadlock from a slow render

  • If the request stops at the same point while the renderer is waiting for an asset URL hosted by the Rails app, investigate server concurrency and reachability.

  • If the renderer is consuming time on a large or complex document, inspect the input and direct executable output before increasing timeouts. A larger timeout does not fix a blocked callback.

  • Compare behavior with a document whose assets are local or embedded. If that succeeds, focus on the callback path rather than PDFKit installation.

Return a PDF response the browser can display

If the response body looks like unreadable or mangled text in the browser, make sure the HTTP response uses Content-Type: application/pdf. PDFKit’s troubleshooting notes identify this header as the fix for browser output that is not treated as a PDF (PDFKit project README).

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

Check the actual response headers in the browser’s network panel or with an HTTP client; do not infer the content type from the filename or the Rails route. Also verify that the response body is the generated PDF rather than an HTML error page returned with a PDF filename. If the header is correct but the file is invalid, return to the renderer’s stderr and asset checks.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Address inconsistent layout, fonts and security

Standardize fonts across environments

Rendering depends on fonts installed in the runtime as well as fontconfig and freetype2, according to the wkhtmltopdf project’s downloads page (wkhtmltopdf downloads). If a PDF’s line breaks, glyphs or spacing differ between machines, compare the installed fonts and runtime images rather than assuming the HTML changed. Install and standardize the fonts the document needs in every environment that generates PDFs.

Do not render untrusted HTML

The wkhtmltopdf project explicitly warns: “Do not use wkhtmltopdf with any untrusted HTML” and cautions that unsanitized user-supplied HTML or JavaScript can compromise the server running the renderer (wkhtmltopdf downloads). Treat user-provided markup as untrusted input: sanitize it, avoid executing arbitrary scripts, and isolate rendering from sensitive services and data where your deployment permits. This is a security boundary, not just a formatting concern.

Symptom-to-fix reference

Symptom Likely cause What to check or change
No wkhtmltopdf executable found Binary is missing, not on the Rails process PATH, or cannot be executed. Locate and run it as the Rails user; check permissions and architecture; set its absolute path in the PDFKit initializer.
PDF omits CSS, images or JavaScript Relative asset URLs, inaccessible host, or missing request context. Use absolute paths or complete URLs, configure root_url or the asset host, and test reachability from the renderer environment.
PDF request hangs in development Single-thread callback deadlock while the renderer requests Rails-hosted assets. Allow another worker to serve callbacks or embed resources to remove the callback.
Browser shows unreadable output Response is not labeled as a PDF, or the body is an error rather than a PDF. Inspect the response and send Content-Type: application/pdf; check renderer errors if the body is invalid.
Layout or glyphs differ between machines Different fonts or fontconfig/freetype runtime dependencies. Install and standardize the required fonts and compare the runtime environments.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Deployment checks before shipping

PDFKit’s documented approach keeps executable ownership, networking, fonts and request concurrency in your deployment. If a team considers a managed HTML-to-PDF renderer instead, compare who owns the executable, how assets and fonts are reached, concurrency behavior, security isolation, observability, deployment work and cost. No specific hosted provider is established here, so evaluate those points against the service you are considering rather than assuming equivalence.

Or skip the browser setup

ScreenshotNeo is a separate website screenshot API and MCP server, not a fix for a missing PDFKit or wkhtmltopdf executable. It can return a screenshot or PDF through one GET request, which may suit a task that needs a captured web page rather than a PDF generated by your Rails application. For details on supported request options, see the ScreenshotNeo API documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo removes cookie and consent banners, newsletter popups and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Every feature is on every plan. Learn about ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

What does “No wkhtmltopdf executable found” mean in a Rails app?

PDFKit could not locate or execute the separate wkhtmltopdf program in the environment used by the Rails process. Verify that the executable is installed and runnable as that process’s user, then configure its absolute path.

Does installing the PDFKit gem install wkhtmltopdf too?

No. PDFKit is the Ruby wrapper; wkhtmltopdf is a separate command-line executable that must be available to the Rails runtime.

Why does the same PDF look different on two machines?

The rendering environments may have different fonts or fontconfig/freetype dependencies. Standardize those runtime components and the required fonts.

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

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.