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.

Use a normal HTML stylesheet link, then give your Java converter a base URI and permission to fetch the resource. For PDFreactor 12.7.1, a document loaded from a URL gets that URL as its base automatically, and linked stylesheets are fetched automatically. If you supply HTML as a string or another non-URL source, configure the base URL explicitly. iText uses the same concept under the name BASEURI. The exact Java call depends on the renderer, so match the example to the library and version you deploy.

1. Put the remote stylesheet in the HTML

The HTML side is standard:

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="https://static.example.com/css/print.css">
</head>
<body>
  <h1>Report</h1>
</body>
</html>

An absolute https:// URL identifies the stylesheet directly. A relative reference such as ../css/layout.css is resolved against the document’s base URL. The renderer process, not the user’s browser, must be able to reach the host, complete TLS verification, and read the response.

Keep the link in the document’s <head>. If the stylesheet itself imports other files or fonts, those URLs also need to resolve from an appropriate base and remain reachable.

2. PDFreactor: URL input versus HTML input

Converting a page at a URL

PDFreactor 12.7.1 automatically uses the source document URL as the base when you convert a URL. Therefore a page such as https://example.com/reports/annual.html can resolve ../css/print.css relative to that location. Linked external resources, including <link> stylesheets, are loaded automatically. See the PDFreactor 12.7.1 Web Service manual for the URL-input API for your edition.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Epson EcoTank ET-2800 Wireless Color All-in-One Supertank Printer - Black
  • 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

Converting an HTML string or local content

When the input is not itself a URL, set a base URL that represents the directory containing the HTML resources. The PDFreactor library manual documents config.setBaseUrl("https://someServer/public/") for this case. A trailing slash matters because relative URL resolution follows normal URL-directory rules.

// Illustrative PDFreactor configuration; use the input/conversion method
// documented for the PDFreactor 12.7.1 library edition.
PDFreactor pdfReactor = new PDFreactor();
Configuration config = new Configuration();
config.setBaseUrl("https://someServer/public/");
// Supply html, then invoke your edition's convert(...) method.

Do not copy a method signature from another renderer: PDFreactor’s web-service and library interfaces differ, and other Java libraries use different configuration objects.

Remote-resource controls

PDFreactor verifies HTTPS certificates and provides connection and read timeout settings. Its documented defaults also restrict protocols, disable filesystem access, and provide controls for network address types. Keep those restrictions narrow when HTML or CSS URLs can be influenced by users; opening filesystem or private-network access can expose resources the converter should never fetch. Details are in the PDFreactor 12.7.1 library manual.

3. iText pdfHTML: set the base URI

iText’s pdfHTML module parses HTML and CSS and maps them to iText objects. When your HTML contains relative CSS, pass the parent location as the base URI (called BASEURI in the iText tutorial). The base should be the directory or URL from which the HTML’s relative resources are published.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Epson EcoTank Photo ET-8550 Wireless Wide-Format All-in-One Tank Printer
  • 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⁴
String html = ""
    + "<html><head>"
    + "<link rel='stylesheet' href='../css/print.css'>"
    + "</head><body>Report</body></html>";

// The concrete ConverterProperties and HtmlConverter calls depend on
// the pdfHTML version; the important setting is the base URI.
ConverterProperties properties = new ConverterProperties();
properties.setBaseUri("https://static.example.com/reports/");
HtmlConverter.convertToPdf(html, new FileOutputStream("report.pdf"), properties);

Consult iText’s Hello HTML to PDF tutorial for the version-specific setup and API. If the stylesheet is already absolute, a base URI is not needed for that link, but it can still be required for images, imported CSS, or fonts.

4. OpenHTMLtoPDF and other renderers

OpenHTMLtoPDF describes support for well-formed XML/XHTML, some HTML5, and CSS 2.1 plus later standards. It is not a full browser engine. Its project documentation and repository are at github.com/danfickle/openhtmltopdf. Supply a base URL through the builder or user-agent/resource-loader configuration used by the exact version you selected, then verify that remote resources are permitted in your deployment.

Renderer behavior is not interchangeable. iText’s official FAQ says pdfHTML does not evaluate JavaScript; OpenHTMLtoPDF supports a bounded markup and CSS subset; PDFreactor documents more extensive resource and security controls. A page that looks correct in Chrome may still lose layout, generated content, web fonts, or script-driven data during conversion.

5. A reliable implementation checklist

  1. Make the link explicit. Prefer an absolute HTTPS stylesheet URL while diagnosing. Confirm the response is CSS, not an HTML login page or redirect.
  2. Choose the base. URL input normally supplies it automatically in PDFreactor. For HTML strings, set PDFreactor’s base URL or iText’s BASEURI; configure the equivalent in your renderer.
  3. Test reachability from Java. The server running the converter may have different DNS, proxy, firewall, or certificate trust than your desktop browser.
  4. Set bounded timeouts. Use the renderer’s connection and read timeout settings so a dead stylesheet cannot hold a job indefinitely.
  5. Check access policy. Allow only required protocols and hosts. Do not broadly enable filesystem or private-network access for untrusted HTML.
  6. Validate CSS support. Replace unsupported browser-only features with print-oriented CSS that your renderer documents as supported.
  7. Compare output at the deployed version. Pin the library version and render a representative document containing fonts, images, nested imports, tables, and page breaks.

6. Troubleshooting external CSS

Symptom Likely cause Fix
Everything is unstyled The link is missing, unreachable, or returns non-CSS content Inspect the final HTML, fetch the URL from the converter host, and verify the response and content type.
Absolute URL works; relative URL fails No base URI, or a base points to the wrong directory Set PDFreactor’s setBaseUrl or iText’s BASEURI; include the correct trailing slash.
Timeout or intermittent missing styles Slow origin, blocked egress, proxy, or restrictive timeout Check network logs, configure connection/read timeouts, and make the stylesheet reliably reachable.
TLS or certificate error The Java runtime cannot validate the HTTPS chain Fix the server certificate or the runtime trust configuration; do not disable certificate verification as a shortcut.
Local file works but remote URL does not Protocol, host, filesystem, or network-address restrictions Review PDFreactor security settings and permit only the required resource location.
CSS downloads but features are absent The renderer does not implement the browser feature or JavaScript is required Check the exact renderer documentation and simplify the stylesheet or pre-render dynamic content.
Fonts or imported CSS are missing Nested URLs resolve against an unexpected base or are blocked Use absolute diagnostic URLs, then correct the base and allow the required resource types.

7. Performance, security, and cost decisions

Reduce avoidable network work

Host CSS close to the conversion service, keep stylesheets small, and avoid chains of unnecessary imports. If you control the application, caching the stylesheet or serving a versioned asset reduces repeated fetch latency. Measure conversion time with cold and warm resource caches; documentation does not establish a universal speed advantage for one renderer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
HP Smart Tank 5000 Wireless All-in-One Ink Tank Printer, Scanner, Copier with 2 Years of Ink Included, Best-for-Home, Cartridge-Free, Refillable and AI-Enabled. (5D1B6A)
  • 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.

Protect the conversion boundary

Remote HTML is an outbound-request capability. Treat URLs and HTML supplied by users as untrusted input. Restrict protocols and destinations, retain certificate validation, disable filesystem access unless required, and prevent access to private network ranges. These controls are particularly important for server-side PDF jobs.

License and feature fit

Compare the exact CSS and HTML features you need, base-URI behavior, JavaScript requirements, deployment model, and licensing. The cited sources do not provide a comprehensive feature benchmark, so a representative document test is more useful than assuming browser equivalence.

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

8. Or skip the browser setup

If your actual need is a rendered image or PDF of a public URL rather than a Java PDF library, ScreenshotNeo provides a single HTTP endpoint. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with the result identified by X-Page-Verdict and X-Billed headers. It also offers an MCP server for Claude, Cursor, and other MCP clients.

Read the full parameter reference in the ScreenshotNeo documentation. A Java application can call the endpoint with any HTTP client:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
var request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.screenshotneo.com/v1/shot"
        + "?access_key=YOUR_API_KEY&url=https%3A%2F%2Fstripe.com"))
    .GET().build();
var response = HttpClient.newHttpClient().send(request,
    HttpResponse.BodyHandlers.ofFile(Path.of("shot.webp")));

The same request in cURL:

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

Python:

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)

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}`);

ScreenshotNeo includes full-page capture, CSS-selector element capture, device and retina settings, PDF options, custom CSS and JavaScript, waits, request blocking, headers, cookies, user agents, timezone and geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Every feature is on every plan: 1,000 shots per month free with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Rank #4
NDYIN Portable Printers Wireless for Travel, N80 Bluetooth Thermal Printer
  • 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

9. Final verification before production

  • Render with the same Java runtime, library version, and network policy used in production.
  • Verify the stylesheet URL, base URI, TLS chain, authentication, and timeout behavior.
  • Test a failure case and confirm the job fails clearly rather than silently producing an unstyled PDF.
  • Inspect page breaks, print colors, fonts, images, imported CSS, and any content that depends on JavaScript.

Frequently Asked Questions

Can I use a relative CSS URL when converting an HTML string?

Yes, if you configure the renderer’s base URI to the directory that contains the HTML resources. Without a base, the relative link has no reliable parent location.

Does loading CSS from HTTPS make Java PDF output identical to a browser?

No. Network retrieval and rendering are separate concerns; each Java renderer supports a defined subset of HTML, CSS, and JavaScript. Test the exact library version with your document.

Should I inline the stylesheet instead?

Inlining can remove one network dependency, but it does not solve unsupported CSS, dynamic content, or missing fonts and images. A correctly configured base URI is usually cleaner for reusable stylesheets.

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.

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.