Recommended Free Tools
To make wkhtmltopdf use the intended content width, set the PDF paper size and left/right margins first, then choose a browser viewport that suits the page’s responsive CSS. Make the HTML container fit that viewport, decide whether the document should use screen or print styles, and only then adjust smart shrinking or zoom. This order separates page geometry from browser scaling and makes a squeezed PDF easier to diagnose.
How wkhtmltopdf determines usable content width
A PDF page’s width is not the same as the space available to your HTML. The relationship runs from paper size to margins, to usable PDF width, to the emulated browser viewport, and finally to the CSS width of the content container. If any link in that chain is narrower than expected, the result may look squeezed, leave excessive whitespace, or overflow the page.
- Paper width: Choose a standard size with
--page-size, or specify dimensions with--page-widthand--page-height. - Margins: Set
--margin-leftand--margin-right. These reduce the width available to page content. - Usable PDF width: This is the paper width minus the left and right margins.
- Viewport: A browser-window width can affect responsive breakpoints and CSS units such as
vw. Set it deliberately with--viewport-sizewhen those rules matter. - CSS container: Check
widthandmax-widthdeclarations on the main wrapper. A fixed-width container wider than the intended layout can trigger scaling or overflow.
The wkhtmltopdf documentation says the default page size is A4 and that --page-size can select other sizes, including A3, Letter, and Legal. Use an explicit size rather than relying on the default when the output must match a known paper format. See the wkhtmltopdf command-line usage documentation for the available page controls.
Set page size, margins, viewport, and media type
Start with a command that makes the key layout inputs visible. This example is a starting point, not a universal preset: choose the paper size, margins, viewport, and media mode to match your own document.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
- 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.
wkhtmltopdf
--page-size A4
--margin-left 12mm --margin-right 12mm
--viewport-size 1200x900
--print-media-type
--disable-smart-shrinking
input.html output.pdf
Here, A4 and 12 mm side margins define the page geometry; the 1200-pixel viewport provides a deliberate browser width for responsive CSS. The print-media flag selects print styles. Disabling smart shrinking gives you a useful comparison point when automatic scaling seems to be changing the apparent size. The example does not guarantee that a 1200-pixel CSS container will fit a particular PDF width: compare your CSS layout with the usable width in the resulting PDF.
Choose paper size before tuning CSS
Use --page-size for standard paper sizes, or specify custom dimensions with --page-width and --page-height when the document calls for a nonstandard page. Page dimensions and margins determine the physical space available; CSS should be adjusted to suit that space rather than using zoom to compensate for an unknown page setup.
Make side margins explicit
Set both horizontal margins even when you think the defaults are acceptable. A larger margin leaves less usable width; a smaller one gives the content more room. If the PDF is unexpectedly narrow, verify the effective page size and both margins before changing the HTML.
Set viewport width for responsive layouts
--viewport-size emulates a browser window size. It is relevant when the page uses media queries or viewport-relative units, because those styles can make the content layout differ from what you expected. The viewport is not a replacement for setting paper dimensions and margins: it controls the emulated browser environment, while those options control the PDF page.
Rank #2
- 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.
Choose screen CSS or print CSS
wkhtmltopdf renders screen media by default. Add --print-media-type when the print stylesheet should define the PDF layout, for example when your CSS includes @media print rules that change widths or hide screen-only elements. If the screen stylesheet is the intended source of truth, omit that flag and check the screen rules instead.
When the PDF differs sharply from a browser preview, check which media rules were applied before editing dimensions. A print rule may set a different wrapper width, while a responsive screen rule may change the layout at the chosen viewport. Make the media choice and viewport intentional, then inspect the relevant container rules.
Inspect the HTML container and overflow
Review the main wrapper’s width and max-width declarations alongside the viewport and usable PDF width. A fixed pixel width can exceed the intended layout. A maximum width can also keep a page narrow even if the PDF has room for more content. Update the CSS or viewport to match the design rather than assuming the PDF renderer will infer the desired width.
Check wide tables, images, and long unbreakable strings separately. These elements may extend beyond the wrapper even when ordinary paragraphs fit. Look for oversized intrinsic image dimensions, table columns that cannot wrap, or long URLs and identifiers. Choose wrapping, resizing, or a layout adjustment appropriate to the content; changing the global zoom may make ordinary text too small without fixing the overflow source.
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 reinstallRank #3
- 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.
Compare smart shrinking and zoom carefully
If content appears scaled down, compare a run with smart shrinking enabled against one using --disable-smart-shrinking. Record the page size, margins, viewport, and zoom for both runs so the comparison changes one factor at a time. Smart shrinking is a renderer behavior; disabling it is a diagnostic option, not a guarantee that every layout will fit without CSS changes.
--zoom changes apparent scale. Use it only after page geometry, viewport, media type, and container width are stable. Otherwise it can obscure the underlying mismatch: text may get smaller while the layout remains based on the wrong width. The command-line documentation describes --zoom and --disable-smart-shrinking along with page and viewport controls.
Use the library settings when calling libwkhtmltox
The library API exposes corresponding controls rather than requiring a CLI command. Its documented settings include size.width and size.pageSize for page dimensions, margin.left and margin.right, screenWidth, smartWidth, load.zoomFactor, and load.printMediaType. Map the same decisions into your application: paper, margins, viewport, media mode, shrinking behavior, and zoom.
Consult the libwkhtmltox page settings documentation for the setting names and supported values. Keep your chosen values together in application configuration or logs; otherwise it is difficult to reproduce a rendering difference between environments.
Rank #4
- 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
Troubleshoot a squeezed or unexpectedly scaled PDF
Work through these checks in order, changing one class of settings at a time:
- Confirm the binary: Check which wkhtmltopdf executable is installed and whether it is the patched-Qt build needed for the feature set you use. Different build capabilities can affect which options are available.
- Fix page geometry: Set the page size or custom dimensions, then set both horizontal margins explicitly.
- Choose a viewport: Set a deliberate viewport width if responsive CSS or
vwvalues affect the result. - Inspect media rules and wrappers: Confirm whether screen or print CSS is active, then review
@media print,width, andmax-width. - Compare shrinking behavior: Render once with the default behavior and once with
--disable-smart-shrinking, holding other values fixed. - Adjust zoom last: Only tune
--zoomafter the preceding geometry and CSS checks. - Find local overflow: Inspect wide tables, images, and long unbreakable strings that may exceed the intended content width.
Symptoms and likely checks
- Everything is smaller than expected: Compare smart shrinking on and off, and verify the usable page width, viewport, and wrapper dimensions before changing zoom.
- The content is narrow with blank space beside it: Check for a restrictive container
max-width, a narrow responsive breakpoint, or print CSS that caps the wrapper. - Some elements cross the page edge: Inspect tables, images, and unbreakable text rather than widening every paragraph container.
- The PDF differs from the browser: Verify whether screen or print media is active and whether the emulated viewport selects a different breakpoint.
- An option does not work as expected: Confirm the installed binary and its build capabilities, then consult the relevant CLI or library documentation for that option.
Or skip the browser setup
If your goal is a screenshot or PDF from a URL rather than controlling a local wkhtmltopdf installation, ScreenshotNeo offers a one-request API. For example, request a PDF using the documented API parameters:
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://stripe.com
-d format=pdf
-o page.pdf
See the ScreenshotNeo API documentation for authentication and supported request options. ScreenshotNeo can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The Free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan and get 1,000 screenshots a month with no card.
Keep a reproducible width record
When a PDF looks wrong, record the executable/build, page size, side margins, viewport, media type, smart-shrinking setting, and zoom used for that output. This makes comparisons meaningful and helps distinguish a CSS change from a renderer-setting change. For a width problem, compare the intended CSS container with the space left after margins, not with the paper’s full width.
Best Value
- 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.
Frequently Asked Questions
What is wkhtmltopdf’s default page size?
The wkhtmltopdf command-line documentation says the default is A4.
Does wkhtmltopdf use print CSS automatically?
No. It renders screen media by default; use --print-media-type to select print styles.
Should I change zoom to make the content wider?
Not first. Stabilize page dimensions, margins, viewport, media rules, and container width before adjusting --zoom.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteQuick 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.

