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

Wicked PDF does not render documents itself: it starts the external wkhtmltopdf executable. A working Rails gem therefore requires four things at runtime: the gem must be in the deployed Bundler environment, Wicked PDF must resolve the correct executable, the process must be able to execute and (for wkhtmltopdf-binary) unpack it, and the operating system must provide compatible libraries, fonts and temporary storage. Check those in that order before changing view options.

What the error actually means

Wicked PDF is a Rails wrapper around the shell utility wkhtmltopdf. Rails can load the wicked_pdf gem while the command is absent, inaccessible or unable to start. Messages such as PDF could not be generated, cannot find wkhtmltopdf and exit status 127 are symptoms of different failures, so identify the failing layer first.

Symptom Most likely layer First check
Bundler says wkhtmltopdf-binary is not included Deployment bundle Loaded gem path in the same release and process context
Wicked PDF cannot find the executable Path resolution Wicked’s resolved path and exe_path
Exit 127; loader reports missing libssl.so.1.1 or libcrypto.so.1.1 OS ABI/runtime Binary, libc and OpenSSL compatibility
Executable starts but images or CSS are missing HTML assets Absolute URLs, helpers, network access and fonts
Intermittent tempfile or extraction errors Filesystem permissions TMPDIR, gem-directory write access and disk space

1. Verify the deployed bundle, not your development machine

Run this from the release directory, with the same Ruby, Bundler configuration and service account that runs Rails:

bundle exec ruby -e 'puts Gem.loaded_specs["wkhtmltopdf-binary"]&.&.full_gem_path'

A printed directory confirms that Bundler activated the gem. A blank result means the process cannot load it, even if /bin/wkhtmltopdf exists. Check the production Gemfile and lockfile, then deploy the updated bundle. Do not rely on an interactive shell’s gems or PATH: systemd, containers, job workers and application servers often have different environments.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
  • Put gem 'wkhtmltopdf-binary' in a bundle group that is installed in production.
  • Run bundle check and bundle exec under the service user.
  • Restart the Rails process after changing gems or environment variables.

PATH visibility and Bundler activation are separate checks. You need both when the application is configured to discover a command rather than use an explicit path.

2. See and set the path Wicked PDF uses

In a Rails console opened in the deployed environment, inspect Wicked PDF’s resolver:

WickedPdf.new.send(:find_wkhtmltopdf_binary_path)

If it returns a nonexistent location, configure the actual executable in an initializer (for example, config/initializers/wicked_pdf.rb):

WickedPdf.configure do |c|
  c.exe_path = '/usr/local/bin/wkhtmltopdf'
  c.enable_local_file_access = true
end

Use the path that exists in the running image or host, not the path from a build stage. If you want the binary gem’s extracted executable, inspect its gem directory and set exe_path only after confirming the file is present and executable. Keep this configuration in source control so CI, staging and production use the same rule.

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

3. Allow the binary gem to unpack on first use

wkhtmltopdf-binary ships compressed platform binaries. On first use it selects a match and extracts the executable into the gem directory. The Rails process therefore needs write permission there until extraction completes, as well as execute permission afterward.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
  1. Identify the gem directory with the Bundler command above.
  2. As the application user, verify that directory is writable and that the extracted file can be executed.
  3. Warm the binary during deployment or a health check, before putting traffic on a new release.
  4. After extraction, remove unnecessary write access if your deployment policy requires an immutable filesystem; retain execute and read access.

Read-only container layers commonly fail on this first run. Extract during the image build into a writable persistent layer, or use a distribution package and explicit exe_path instead. Avoid “fixes” that make the entire filesystem writable when only the gem directory or a cache volume is needed.

4. Diagnose exit 127 before changing Wicked PDF options

Exit 127 generally means the command could not be started or its dynamic loader could not load a required library. On Alpine, a reported 0.12.5 binary failed after an OpenSSL 3 upgrade because libssl.so.1.1 and libcrypto.so.1.1 were missing. This is an operating-system compatibility failure; HTML flags, JavaScript delays and Rails view code cannot repair it.

Choose a compatible binary and base image

  • Match the binary’s libc and OpenSSL ABI to the image that runs Rails.
  • Use a supported distribution package when the binary gem does not match your platform.
  • Pin the base image and package versions so a routine OpenSSL or libc upgrade does not silently change the loader environment.
  • Test the exact production image, not only a development laptop.

On minimal Alpine-style images, verify whether the downloaded executable expects glibc while the image supplies musl. Installing a random compatibility package may mask one missing library and leave the binary unsupported; replacing it with a binary built for the image is usually more reliable.

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

Inspect the executable as the service user

command -v wkhtmltopdf
ls -l /actual/path/wkhtmltopdf
/actual/path/wkhtmltopdf --version
ldd /actual/path/wkhtmltopdf

command -v tests PATH, --version tests startup, and ldd exposes unresolved shared libraries on systems that provide it. If --version fails, stop there and repair the image or binary before investigating HTML.

5. Check temporary directories and permissions

Wicked PDF and the executable create temporary files. A valid path can still fail when TMPDIR points to a nonexistent directory, the directory is not writable, disk space is exhausted or a container mounts it with restrictive permissions.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  1. Print the runtime value of ENV['TMPDIR'] from the Rails process.
  2. Confirm the directory exists, is writable by the service account and has sufficient space.
  3. Reproduce a conversion under that account, not as root.
  4. Check cleanup behavior and inode limits when many PDFs are generated concurrently.

Use a dedicated writable temporary volume in containers and set TMPDIR explicitly when the platform’s default is unsuitable. Never put secrets in generated temporary paths or log complete URLs containing credentials.

6. Supply fonts and rendering dependencies

Even after the executable starts, output can be blank, clipped or visually different when the image lacks the fonts and libraries used by the document. The wkhtmltopdf runtime depends on fontconfig and freetype2. Install the fonts your PDFs actually require, then refresh or point fontconfig at them (for example with FONTCONFIG_PATH in a custom image).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Include Latin, CJK, emoji or corporate fonts explicitly when documents use them.
  • Rebuild the font cache during image creation where your distribution requires it.
  • Compare a known test page in CI so a base-image change is visible.

Font problems are rendering problems, not executable-discovery problems: do not “solve” them by adding more PATH entries.

7. Make CSS, JavaScript and images reachable

wkhtmltopdf runs outside the Rails request process. Relative asset paths that work in a browser can fail when the converter has no matching current URL, authentication cookie or host resolution. Use absolute, reachable URLs or Wicked PDF’s asset helpers (such as the wicked_pdf_* helpers) in the HTML you render.

  • Ensure the converter can resolve the hostname from its network namespace.
  • Provide authentication headers or a signed asset URL when assets are protected.
  • Use the local-file option only when you intentionally serve local assets; keep enable_local_file_access scoped to the files required.
  • Check every image and stylesheet. A missing image can affect other images in the same document, so fix the first failed asset rather than accepting a partially rendered PDF.

For JavaScript-heavy pages, wait for the content your template needs and make sure external scripts are available from the converter’s network. A successful process exit does not guarantee that dynamic content finished rendering.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

8. A repeatable production repair sequence

  1. Run the Bundler gem-path command in the deployed context.
  2. Inspect find_wkhtmltopdf_binary_path and compare it with the file inside the running host or container.
  3. Set c.exe_path explicitly when discovery is unreliable.
  4. Allow first-run extraction, then verify execute permission.
  5. Run wkhtmltopdf --version and inspect loader dependencies; repair libc/OpenSSL mismatches.
  6. Verify TMPDIR, disk space and tempfile permissions.
  7. Install and configure required fonts.
  8. Render a minimal HTML page, then add CSS, images and JavaScript one dependency at a time.
  9. Pin the resulting image, gem lockfile and initializer in CI and production.

How to compare repair options

Repair choice Advantages Risks to verify
Binary gem with explicit path Simple Bundler deployment and repeatable Rails configuration Extraction permissions and platform/ABI support
OS distribution package Libraries are managed with the base image Package version, patch cadence and rendering differences
Custom pinned image Full control over binary, fonts and dependencies Long-term maintenance and security updates

Evaluate each candidate on binary provenance and version, OS/libc/OpenSSL compatibility, execution and unpack permissions, temporary storage, fonts and assets, and whether CI can reproduce production exactly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a clean website image rather than a Rails-generated PDF, ScreenshotNeo provides a single request API at https://screenshotneo.com. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. An MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

See the complete parameter reference at https://screenshotneo.com/docs/. This runnable cURL example captures a WebP image:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

It also supports full-page and element captures, device presets, custom viewports, retina scale, PDFs, HTML/CSS input, custom CSS and JavaScript, clicks, waits, blocked requests, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification. The parameter names used by other screenshot APIs work as well.

The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

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.

Troubleshooting checklist by error

“cannot find wkhtmltopdf”

Confirm the gem is activated, inspect Wicked’s resolved path, then set exe_path to an executable file in the running environment. Restart Rails after changing the initializer.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

“PDF could not be generated” with no loader message

Run the executable directly as the service user, then test a minimal page. If direct startup works, inspect temporary storage and asset URLs; if it does not, repair the binary/runtime first.

Exit 127 after an image or OpenSSL update

Look for missing shared libraries such as libssl.so.1.1 or libcrypto.so.1.1. Pin a compatible image/package or replace the binary; Wicked PDF options are unrelated.

First request fails, later requests work

The binary likely could not unpack on first use. Grant temporary gem-directory write access or extract during deployment, then verify the extracted file’s permissions.

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

PDF opens but is missing images or fonts

Use absolute or Wicked PDF helper URLs, verify network and authentication, install the required fonts and check fontconfig. Test assets individually.

FAQ

Should I install both a system package and wkhtmltopdf-binary?

Usually choose one controlled source and configure it explicitly. Installing both can hide which executable Rails actually invokes and makes upgrades harder to reproduce.

Can changing enable_local_file_access fix exit 127?

No. That option affects access to local assets after the process starts. Exit 127 indicates command startup or loader failure.

Why does it work in a Rails console but fail in a job worker?

The worker may use a different service account, environment, container image, PATH, TMPDIR or Bundler group. Compare those values in the failing process rather than the interactive console.

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

Do I need a compatibility matrix for every Ruby and Rails version?

No universal matrix covers every combination. Pin and test the binary, base image, libc/OpenSSL libraries, fonts and deployment process that you actually ship.

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.