Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesTo load CSS in a Wicked PDF, use a stylesheet reference that the external wkhtmltopdf process can actually reach. The right helper depends on your Rails asset setup: use wicked_pdf_stylesheet_link_tag for the documented non-pipeline setup, ensure asset-pipeline stylesheets are precompiled, or use wicked_pdf_stylesheet_pack_tag with Webpacker. A relative link that works in a normal Rails page may fail in the PDF because the converter runs outside the ordinary Rails layout and request environment.
Why CSS works in Rails but not in the PDF
Wicked PDF renders HTML through Rails, then passes it to the separate wkhtmltopdf command-line program to create the PDF. That program does not automatically share the browser page’s asset-resolution context. A relative stylesheet path may resolve in the browser but not when the converter processes the HTML.
The Wicked PDF project README puts it plainly: “The wkhtmltopdf binary is run outside of your Rails application; therefore, your normal layouts will not work.” The practical implication is to provide an absolute asset reference or a valid local path accessible to the converter, rather than assuming the PDF can reuse the browser’s relative paths.
First identify how this Rails app serves assets. The helper appropriate for an app without an asset pipeline is not interchangeable with the asset-pipeline or Webpacker helper.
#1 Best Overall
- EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
- READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
- CREATE, COMBINE, SCAN and COMPRESS PDFs
- FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
- LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
Choose the CSS-loading method for your asset setup
| Rails asset setup | What to do | Key check |
|---|---|---|
| No asset pipeline | Use wicked_pdf_stylesheet_link_tag in the PDF layout. |
Do not add an /assets/ prefix to the asset name passed to the Wicked PDF helper. |
| Rails asset pipeline | Precompile the PDF stylesheet and other assets used by the PDF view. | Confirm the generated asset exists in the deployed precompiled output, especially when production has config.assets.compile = false. |
| Webpacker | Use wicked_pdf_stylesheet_pack_tag for stylesheets. |
Use the corresponding documented pack helpers for JavaScript, or direct pack-path access where appropriate. |
| CSS hosted remotely | Link to an absolute CDN URL. | Verify the converter’s runtime can reach the URL and that it remains available. |
| CSS supplied to the converter | Consider wkhtmltopdf’s --user-style-sheet option. |
The file path must be accessible to the external process, and the installed binary must support the option. |
Without an asset pipeline
Put the stylesheet link in the layout used to render the PDF and call the Wicked PDF helper:
<%= wicked_pdf_stylesheet_link_tag "pdf" %>
Use the asset name, such as pdf, without an /assets/ prefix. The helper is intended to produce a reference usable by the external converter. If the rendered HTML still contains a relative reference, inspect how the helper is configured and whether the converter can access the resulting URL or path.
With the Rails asset pipeline
Ensure the PDF stylesheet is included in the application’s precompiled assets. A setup that appears to work in development may fail after deployment: production may not compile assets on demand, particularly when config.assets.compile = false. The converter cannot load a stylesheet that was never published or is not reachable at the generated asset URL.
Precompilation matters for every asset your PDF view references, not just the main CSS file. If styles import fonts or images, verify those resources are present and reachable as well.
Rank #2
- Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
- Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
- Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
- Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
- Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.
With Webpacker
Use Wicked PDF’s pack helper for the stylesheet, for example:
<%= wicked_pdf_stylesheet_pack_tag "pdf" %>
Wicked PDF also documents pack helpers for JavaScript and direct pack-path access for assets. Keep the PDF view aligned with the pack system configured in the app; mixing an asset-pipeline helper into a Webpacker-only setup can produce a link that looks plausible in HTML but points nowhere useful.
Remote CSS or a converter-level stylesheet
An absolute CDN URL can work when the converter process has network access. Test it from the same host or container and runtime context that runs wkhtmltopdf; a URL reachable from your workstation or browser is not proof that the deployed process can fetch it.
Alternatively, wkhtmltopdf documents --user-style-sheet for a stylesheet supplied at the command line. This is a converter option, not a replacement for understanding how the rest of the PDF HTML references assets. Confirm the option exists in your installed build and that the path is visible to the process. Wicked PDF warns that binary options vary by version.
Rank #3
- EVERY PDF TOOL UNLOCKED - 30+ tools in one app: edit text and images, convert, merge, split, compress, sign, OCR, redact, watermark, batch process, and more. No feature gates, no upsells, nothing held back.
- PAY ONCE, OWN FOREVER — A one-time purchase, not a subscription. Other apps runs $240/year — Scrivar is yours for life, with free updates included.
- UNLIMITED eSIGN, BUILT IN — Send contracts and forms for signature and track every step. Recipients sign in their browser with no account or app needed. Replace DocuSign and save hundreds a year.
- PC, MAC, AND WEB — Install on any Win 10/11 PC or macOS 11+ Mac (Intel or Apple Silicon), or work in your browser at scrivar.com. Same tools, same account, everywhere you work.
- OCR + FULL OFFICE CONVERSION — Turn scanned documents into searchable, selectable text, and convert PDFs to and from Word, Excel, and PowerPoint with formatting kept intact.
Debug a missing stylesheet in a reliable order
- Identify the asset system. Determine whether the PDF uses no asset pipeline, the Rails asset pipeline, or Webpacker. Apply the matching helper and deployment requirements above.
- Inspect the HTML rendered for the PDF. Find the stylesheet’s
href. It should be an absolute URL or a valid path, not a relative reference that only makes sense in the normal browser page. - Check reachability as the converter. From the same host or container and runtime context that invokes
wkhtmltopdf, verify the generated URL or local file is accessible. This catches differences in hostnames, authentication, network access, and filesystem paths between Rails and the converter. - Verify production assets. For the asset pipeline, confirm the PDF CSS is actually in the precompiled output and that the URL emitted by the rendered HTML maps to that output.
- Check local-file access deliberately. If CSS, fonts, or images use local files, review the local-file-access configuration and any allowed paths. Limit access to the locations the PDF needs; do not broadly enable filesystem access without a deployment reason.
- Separate loading from CSS support. If the stylesheet request succeeds but a particular rule has no effect, investigate whether the installed renderer supports that CSS behavior. Successful loading does not establish that every modern CSS feature will render as expected.
Common failures and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| PDF has no styles, but the browser page does. | The converter received a relative or otherwise unusable stylesheet reference. | Use the helper for the app’s asset system, then inspect the rendered HTML and make sure the reference is absolute or a valid local path. |
| Works locally, fails after deployment. | The CSS was not precompiled, its production URL differs, or the converter cannot reach the deployed asset host. | Check the production precompiled output and test the emitted URL from the converter’s runtime environment. |
| The helper produces a URL that returns an error. | The asset name or helper does not match the configured asset system, or the referenced asset is absent. | Use the correct helper and asset name; for the non-pipeline helper, omit the /assets/ prefix. |
| CSS is on a CDN but not reflected in the PDF. | The converter cannot access the remote host, or the URL is unavailable to that runtime. | Test the exact URL from the converter’s host/container and check network and URL availability. |
| A local stylesheet or image is blocked. | Local-file access is disabled or the path is outside the configured allowed locations. | Review the installed build’s local-file options and permit only the necessary path. |
| The CSS loads, but a layout rule is ignored. | The issue is renderer behavior rather than stylesheet discovery. | Check the specific rule against the actual deployed wkhtmltopdf build and choose a compatible rule or rendering approach if needed. |
| A documented command-line option is rejected. | The installed binary/build may not support that flag. | Check the exact executable and its supported options rather than assuming the gem version determines binary capabilities. |
Check the wkhtmltopdf executable, not only the gem
Wicked PDF is a wrapper; the executable that performs rendering is a separate part of the deployment. Record and verify the actual wkhtmltopdf binary and build used by the application. Do not infer its version or supported options from the Wicked PDF gem alone: packaged distributions may differ, and the project’s README warns that options are version-specific.
The upstream wkhtmltopdf repository is archived and read-only as of January 2, 2023. Its changelog lists 0.12.6 dated June 11, 2020, while 0.12.7 is marked unreleased. Those are repository details, not a guarantee about the executable packaged on a particular server. For long-term maintenance, test against the deployed binary and account for the upstream maintenance status when planning upgrades or relying on newer CSS behavior.
Or skip the browser setup
ScreenshotNeo is a website screenshot API, not a replacement for configuring Wicked PDF or generating a styled Rails PDF. If your immediate task is to capture a web page as an image or PDF instead, one GET request can return a screenshot. See the ScreenshotNeo API and its API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
For page captures, cookie banners are accepted like a visitor and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. An 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 with no card; paid plans start at $5 for 3,000 shots. Sign up for the free plan.
Outdated 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 matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Frequently Asked Questions
How can I tell whether a stylesheet is loading or its CSS rules are unsupported?
Inspect the PDF-rendered HTML’s stylesheet reference and verify that the converter can retrieve it. If retrieval succeeds but a rule has no effect, test that rule against the exact deployed wkhtmltopdf build; loading and CSS-engine support are separate questions.
Does changing the Wicked PDF gem version guarantee newer wkhtmltopdf options?
No. Wicked PDF wraps an external executable, and available command-line options depend on the installed binary and build. Check the executable actually used by the application.
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.

