What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Direct answer: make the stylesheet URL resolvable from the PDF renderer’s process. Use an absolute https:// URL, or provide a meaningful document/base URL (such as PDFKit’s root_url or Grover’s display_url) so relative links such as /assets/pdf.css can be expanded. The renderer must also be able to reach the host and obtain the CSS without browser state it does not have.
The HTML link and a renderer API’s stylesheet option are separate mechanisms. Which one you should use depends on whether you pass an HTML string, a URL, or a file, and on whether your Ruby library uses wkhtmltopdf or Chromium.
Choose the loading method for your Ruby renderer
| Renderer | How to supply CSS | Relative URL handling | Important boundary |
|---|---|---|---|
| PDFKit (wkhtmltopdf) | Link CSS in HTML; use stylesheets for HTML input |
root_url or protocol |
stylesheets cannot be added when source is a URL or File |
| Direct wkhtmltopdf | User stylesheet option or a link in the page | Configure URL/path and resource loading | Local-file access and remote URL access are different concerns |
| Grover (Chromium) | Link CSS in HTML or style_tag_options |
display_url or absolute URLs |
Without a display URL, Grover uses http://example.com as its default base |
PDFKit with wkhtmltopdf
Absolute URL in the HTML
For an HTML string, the most portable approach is to emit a complete URL:
require "pdfkit"
html = <<~HTML
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.example.com/assets/pdf.css">
</head>
<body><h1>Invoice</h1></body>
</html>
HTML
kit = PDFKit.new(html)
File.binwrite("invoice.pdf", kit.to_pdf)
This avoids ambiguity about what /assets/pdf.css means. It still requires the machine running wkhtmltopdf to resolve DNS, establish HTTPS, and download the file.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
- COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
- ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
- HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs
Resolve root-relative paths with root_url
When the HTML contains root-relative assets, give PDFKit the site root and protocol:
require "pdfkit"
html = File.read("invoice.html")
kit = PDFKit.new(
html,
root_url: "https://www.example.com/",
protocol: "https"
)
File.binwrite("invoice.pdf", kit.to_pdf)
With that base, /assets/pdf.css resolves under https://www.example.com/. A protocol-relative URL such as //cdn.example.com/pdf.css needs the intended protocol; setting protocol: "https" prevents an accidental HTTP request.
Use PDFKit’s stylesheets helper only with HTML input
For an HTML string, PDFKit can append a stylesheet path:
kit = PDFKit.new(html)
kit.stylesheets << "/absolute/path/to/pdf.css"
File.binwrite("invoice.pdf", kit.to_pdf)
PDFKit documents a critical limitation: stylesheets cannot be added with this helper when the source is supplied as a URL or File. If you call PDFKit.new("https://example.com/invoice") or pass a file source, put the <link> element in that document, or change to HTML-string input. For a remote document, an absolute stylesheet URL in the page is usually simplest.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Direct wkhtmltopdf controls
Calling wkhtmltopdf directly gives access to its user-stylesheet and load settings. A user stylesheet can be a URL or a local path. Resource-load behavior can be configured to abort, skip, or ignore failed resources, depending on the executable’s supported options.
Rank #2
- CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
- INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
- PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
- ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴
wkhtmltopdf
--user-style-sheet https://www.example.com/assets/pdf.css
https://www.example.com/invoice invoice.pdf
Check the help output of the exact wkhtmltopdf build installed on the server before relying on an option name or default. Local-file access controls affect file:// assets; they do not make an external HTTPS host reachable. Keep those two cases separate when diagnosing missing CSS.
Grover with Chromium
Set display_url for relative resources
Grover uses Chromium. When you provide an HTML string, set a display URL that represents the application page:
require "grover"
html = File.read("invoice.html")
pdf = Grover.new(
html,
display_url: "https://www.example.com/invoices/preview"
).to_pdf
File.binwrite("invoice.pdf", pdf)
Now a link such as /assets/pdf.css is resolved against https://www.example.com. Without display_url, Grover defaults to http://example.com, which is rarely the host containing your application assets.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteInject a stylesheet URL explicitly
Grover also supports stylesheet options. Use a URL when the CSS is remote:
grover = Grover.new(
html,
style_tag_options: {
url: "https://cdn.example.com/assets/pdf.css"
}
)
File.binwrite("invoice.pdf", grover.to_pdf)
Documented alternatives include a local path or inline content. Choose one source for each rule set and avoid accidentally loading an old local copy together with the production stylesheet.
Rank #3
- SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
- INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
- KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
- PREMIUM SUPPORT - Strong technical expertise to solve issues faster
- THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
Rails-generated HTML: verify the rendered link
stylesheet_link_tag can generate a full path relative to the document root or a URL. That only creates markup; Chromium or wkhtmltopdf still has to fetch the resulting href.
- Render the view to a string in the same environment used for PDF generation.
- Inspect the final
<link rel="stylesheet" href="...">, not the ERB helper call. - Confirm whether the value is relative, root-relative, protocol-relative, or absolute.
- Set
root_url(PDFKit),display_url(Grover), or rewrite the HTML to an absolute HTTPS URL.
Asset helpers may produce a host that is valid in a browser but unavailable inside a worker, container, or isolated network. Configure the application’s asset host and the renderer’s base URL consistently.
Recommended Free Tools
A reliable debugging sequence
1. Inspect the exact HTML input
Save the string passed to the library and search for every stylesheet link. Check for typos, empty href values, redirects, and CSS URLs hidden behind a client-side loader. A PDF renderer will not execute an application’s build pipeline for you.
2. Try one absolute HTTPS URL
Temporarily replace the relative link with a known absolute URL. If styling appears, the CSS itself is valid and the failure is URL resolution or base selection. Keep the permanent fix in the renderer configuration or generated HTML rather than depending on this diagnostic substitution.
3. Test from the renderer’s runtime
Run an HTTP request from the same container, VM, user account, and network namespace that launches the PDF process. A developer laptop may have DNS, proxy credentials, VPN access, or cookies unavailable to the worker. An authenticated HTML page also does not prove that its CSS endpoint accepts the renderer’s request.
Rank #4
- Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
- No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
- Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
- Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
- The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art
4. Check redirects, authentication, and certificates
- A CSS URL that redirects to a login page is not a stylesheet.
- Private assets may require cookies, an authorization header, or a signed URL that the renderer does not possess.
- Internal certificate authorities must be trusted by the renderer process.
- Mixed-content rules can block an HTTP stylesheet when the document is HTTPS.
5. Read renderer logs and load errors
Enable the diagnostic and load-error options supported by your installed wkhtmltopdf or Chromium integration. Record the requested URL, HTTP status, redirect target, and failure reason. Builds differ, so consult the executable’s own help output rather than assuming options from another version.
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 matchWindows 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 reinstallCommon failures and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| All CSS is missing | Relative link has no meaningful base | Use an absolute URL, PDFKit root_url, or Grover display_url |
| Images work but CSS does not | CSS href points to a different host or requires authentication |
Test the CSS URL directly from the renderer runtime and provide accessible credentials or a signed URL |
stylesheets appears ignored |
PDFKit source is a URL or File | Put the link in the source document or switch to HTML-string input |
| Works locally, fails in production | Worker cannot resolve DNS, reach the host, or trust its certificate | Test network access from the production renderer process and fix egress, proxy, DNS, or CA configuration |
| Only some rules apply | CSS import, media query, or stylesheet order differs | Inspect computed styles, make imports absolute, and ensure the print stylesheet is loaded before conversion |
| Renderer hangs or times out | Slow or blocked asset request | Remove unreachable dependencies, host critical CSS close to the renderer, and configure an appropriate timeout |
Performance, reliability, and security considerations
- Prefer deterministic assets: a versioned CSS URL or embedded content avoids changes during a long-running job.
- Reduce dependency chains: each CSS
@import, font, and image adds another request that can fail or delay conversion. - Use a dedicated print stylesheet: include
@media printrules and avoid interactive JavaScript-controlled styling when static CSS is sufficient. - Protect private documents: do not put long-lived secrets in public stylesheet URLs. Use short-lived signed URLs or a renderer-supported authenticated request mechanism.
- Control local-file access: permit only the local paths you need; external URL reachability and local-file permissions are separate settings.
- Cache carefully: renderer or proxy caches can preserve an old stylesheet. Version filenames or query strings when you intentionally publish a new CSS build.
Or skip the browser setup
If your goal is a visual capture rather than a paginated, selectable PDF, ScreenshotNeo provides a single-call website screenshot API. It accepts 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 page verdict and billing status in headers. It also offers an MCP server for AI agents, including Claude and Cursor.
For a quick image capture, see the ScreenshotNeo documentation and run:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The equivalent Ruby request is:
require "net/http"
require "uri"
uri = URI("https://api.screenshotneo.com/v1/shot")
uri.query = URI.encode_www_form(
access_key: "YOUR_API_KEY",
url: "https://stripe.com"
)
response = Net::HTTP.get_response(uri)
raise "Screenshot failed: #{response.code}" unless response.is_a?(Net::HTTPSuccess)
File.binwrite("shot.webp", response.body)
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
require('fs').writeFileSync('shot.webp', Buffer.from(await res.arrayBuffer()));
Every plan includes the features. The Free plan provides 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
FAQ
Should I embed CSS instead of loading it by URL?
Embedding or inlining critical rules removes a network dependency, but external fonts, images, and imported styles can still require access. Use absolute URLs or a configured base for anything that remains external.
Does a successful browser preview guarantee a successful PDF?
No. The PDF process may run in another network, lack cookies, use a different user agent, or trust different certificates. Test from the actual renderer runtime.
Which base setting should I use in a Rails app?
Use PDFKit’s root_url for wkhtmltopdf or Grover’s display_url for Chromium when your generated HTML contains relative paths. Inspect the rendered HTML first.
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.

