Recommended Free Tools
If a Chart.js chart is missing, clipped, blurry, or different in a headless Chrome PDF, first check the chart’s container dimensions and whether Puppeteer is applying print styles. Then resize the chart after the PDF layout is established, disable animation if timing is unpredictable, and wait for your application to signal that data and drawing are complete before calling page.pdf(). These are separate failure modes; increasing resolution will not fix a chart that never rendered.
Identify what is wrong before changing settings
“Chart data disappearing when I resize the window?” can describe more than one problem. A PDF makes the distinction important because its page size and media styles may differ from the browser viewport where the chart looked correct.
- No chart at all: investigate whether the chart was initialized, whether its data arrived, whether its container had usable dimensions, and whether PDF generation began too early.
- Chart clipped or incorrectly sized: check the container and the dimensions Chart.js sees after print layout is applied.
- Chart visible but blurry: first make its size correct, then consider pixel density.
- Chart differs from the screen view: determine whether the PDF should use print or screen media styles and test the corresponding layout deliberately.
Do not treat these symptoms as interchangeable. For example, a higher devicePixelRatio can increase pixel density, but it cannot initialize a chart or give a zero-height container a usable size.
Fix the chart container and responsive dimensions
Chart.js uses its parent container to update the canvas render and display sizes. The canvas’s CSS display size and its internal render size are distinct, so sizing only the canvas with CSS can leave the chart laid out incorrectly. Give it a dedicated, relatively positioned parent with dimensions appropriate to the PDF content area.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →#1 Best Overall
- Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.
- EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
- READ and Comment on PDFs – Intuitive reading modes & document commenting and mark up tools!
- CREATE, COMBINE, SCAN and COMPRESS PDFs.
- FILL forms & Digitally Sign PDFs. Work with Digital certificates
<div class="chart-container">
<canvas id="report-chart"></canvas>
</div>
.chart-container {
position: relative;
width: 100%;
height: 320px;
}
The 320-pixel height is an example, not a universal PDF measurement. Choose dimensions for the actual report layout. Avoid relying on viewport-relative sizing unless you have verified what it resolves to in the PDF page layout.
A typical chart setup for a container whose height you control can look like this:
const chart = new Chart(document.getElementById('report-chart'), {
type: 'bar',
data,
options: {
responsive: true,
maintainAspectRatio: false,
animation: false
}
});
maintainAspectRatio: false lets the chart use the container’s controlled height rather than preserving its default aspect ratio. Keep the container’s width and height meaningful in the layout where the PDF is produced.
Choose print or screen media intentionally
Puppeteer’s Page.pdf() generates a PDF using the print CSS media type by default. Print styles can change chart dimensions, surrounding layout, and colors, even when the page looks right on screen.
Rank #2
- ULTIMATE IMAGE PROCESSNG - GIMP is one of the best known programs for graphic design and image editing
- MAXIMUM FUNCTIONALITY - GIMP has all the functions you need to maniplulate your photos or create original artwork
- MAXIMUM COMPATIBILITY - it's compatible with all the major image editors such as Adobe PhotoShop Elements / Lightroom / CS 5 / CS 6 / PaintShop
- MORE THAN GIMP 2.8 - in addition to the software this package includes ✔ an additional 20,000 clip art images ✔ 10,000 additional photo frames ✔ 900-page PDF manual in English ✔ free e-mail support
- Compatible with Windows PC (11 / 10 / 8.1 / 8 / 7 / Vista and XP) and Mac
| Media choice | Use it when | What to verify |
|---|---|---|
| Print media (default) | The PDF should follow the site’s print-specific styles. | Chart container dimensions, page breaks, colors, and the surrounding print layout. |
| Screen media | The PDF should preserve screen-oriented styling instead of print-specific changes. | That screen layout fits the PDF page and produces acceptable breaks, chart dimensions, and colors. |
If screen styling is intentional, set the media type before generating the PDF:
await page.emulateMediaType('screen');
await page.pdf({ path: 'report.pdf' });
Do not switch to screen media simply to make a chart appear. It can also retain screen-oriented page layout that is unsuitable for a paginated document. If print CSS is the intended output, keep the default and make the chart work in that layout.
Resize after the PDF layout is applied
Responsive resizing and print layout can interact in ways that do not produce the dimensions the PDF needs. Chart.js supports explicit dimensions through chart.resize(width, height). Call it after the page has entered the intended media mode and the container dimensions have settled.
// Run in the page's PDF preparation path, after print layout is applied.
chart.resize(700, 320);
chart.update('none');
window.chartReady = true;
The values above are examples; select a width and height that fit the chart’s PDF content box. This is an integration pattern, not a guarantee that a particular application or dependency version will behave identically. Confirm the update('none') behavior against the Chart.js version installed in your project before relying on it.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsRank #3
- 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
- 1 Year License for 1 Windows & 2 Mobile (Android and/or iOS) devices.
If your application creates charts on a page with multiple charts, make the PDF preparation step resize the intended chart instances, not an unrelated or stale instance. Likewise, do not signal readiness until the data and drawing work that matters to the report has finished.
Wait for the chart, not just for navigation
A completed navigation does not establish that application data fetching, initialization, or Chart.js drawing has completed. Puppeteer’s PDF guide says PDF generation waits for fonts by default; that is not a guarantee that arbitrary application work is finished.
Have the page set an application-owned readiness flag only after the relevant data is available and the chart has been prepared. Then wait for that flag before creating the PDF:
await page.goto(reportUrl);
// The application sets window.chartReady only after its chart is ready.
await page.waitForFunction(() => window.chartReady === true);
await page.pdf({ path: 'report.pdf' });
Adapt this to your application’s own readiness mechanism. If it uses print layout, ensure the chart preparation and explicit resize happen after that layout is applied. If it deliberately uses screen styles, call page.emulateMediaType('screen') before the preparation step and PDF generation.
Rank #4
Improve sharpness only after layout is correct
Chart.js defaults devicePixelRatio to window.devicePixelRatio. Its documentation notes that a value above the default may be desirable when converting to a bitmap or printing at higher DPI. This is a resolution adjustment, not a layout fix.
const chart = new Chart(document.getElementById('report-chart'), {
type: 'bar',
data,
options: {
responsive: true,
maintainAspectRatio: false,
devicePixelRatio: 2,
animation: false
}
});
The value of 2 is an example to test, not a universally recommended setting. Compare candidate values against the rendered PDF’s sharpness, file size, and generation time. There is no single value established for every chart, page size, or workload. If the chart is absent or the wrong size, return to container sizing, media choice, and readiness instead.
Make rendering timing predictable
Chart.js performance guidance shows animation: false as a way to disable animation. It can make a capture path less dependent on animation timing, especially when output is generated automatically, but it is not a universal cure for a blank chart. The important sequence is to have the application finish the data and chart work, perform any print-specific resize, and only then signal readiness to the Puppeteer caller.
End-to-end Puppeteer pattern
This example assumes that the page owns the chart and implements a preparation function that applies the dimensions needed for its report. Adapt the page-side function and media choice to your application. The dimensions shown are illustrative.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Best Value
- Complete Audio/Visual Lessons
- PDF instruction manual (303 pages)
- Introductory through advanced material for version 2022
- Over 7.5 hours of video lessons (190 individual lessons)
- Quiz, Optional Final Exam, Certificate of Completion
await page.goto(reportUrl);
// Keep the default print media when the PDF should use print CSS.
// If screen styles are intentional, set screen media before preparation:
// await page.emulateMediaType('screen');
await page.evaluate(() => {
// The application should expose this function after creating its chart.
window.prepareChartForPdf();
});
await page.waitForFunction(() => window.chartReady === true);
await page.pdf({ path: 'report.pdf' });
In the page, the application-owned preparation function should run only when the chart instance and its data are available. For example, it can resize the chart after the relevant layout is established, update it using behavior supported by the installed Chart.js version, and then set window.chartReady = true. Do not set the flag merely because navigation ended or because the function was called; make it represent the readiness condition you actually need.
Troubleshoot by symptom
| Symptom | Likely cause to check | Practical fix |
|---|---|---|
| Entire chart is missing | Chart initialization, data loading, or drawing has not completed before PDF generation; the container may also have unusable dimensions. | Check the application’s chart and data lifecycle, give the chart a dedicated sized container, and wait for an application-owned ready signal. |
| Chart is clipped or wrong-sized | Print CSS or page layout changes the container after responsive sizing. | Inspect the container under the PDF’s chosen media type and explicitly resize after that layout is applied. |
| Chart looks correct in browser but different in PDF | Page.pdf() uses print media by default, so print rules may change layout or colors. |
Decide whether print or screen styling is intended; test its page breaks and dimensions rather than changing media blindly. |
| Chart is visible but soft | Pixel density may be insufficient for the intended output. | After fixing size, test a higher devicePixelRatio and compare sharpness with file size and render time. |
| Output sometimes captures an unfinished chart | Capture timing depends on application work or animation. | Disable animation if appropriate and wait for an application-owned readiness condition instead of relying on navigation completion. |
Performance and reliability trade-offs
- Explicit sizing versus responsive sizing: responsive sizing is convenient when the container is stable; explicit
resize(width, height)is more predictable when the PDF layout requires known dimensions. In either case, use the layout that will actually be printed. - More pixel density versus output cost: a higher device-pixel ratio can improve print sharpness, but compare the resulting PDF size and generation time in your own workload.
- Readiness versus arbitrary delays: an application-owned signal expresses that the chart is ready; a fixed delay only waits a duration and does not itself prove that data or drawing completed.
- Print versus screen styles: the right choice is the one matching the intended document. Test page breaks, chart size, and colors under that media type.
Or skip the browser setup
If you need a hosted screenshot of a page rather than debugging your own Puppeteer PDF pipeline, ScreenshotNeo is a screenshot API and MCP server for developers. It can return PNG, JPEG, WebP, or PDF, but this one-call example requests the API’s screenshot output; it does not configure your Chart.js print layout or guarantee that a particular dynamic chart is ready.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for API details. Before a capture, it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can each be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. 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 per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for 1,000 free screenshots a month—no card required.
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.

