How to turn HTML from ChatGPT canvas into a clean PDF

Updated: · Dawwerni team

Title card about exporting an HTML page written in ChatGPT canvas to a clean PDF file

Copy the HTML from ChatGPT canvas into a file saved as page.html and open it in your browser. Then export with a converter that waits for the Tailwind CDN and charts, freezes animations, keeps dark backgrounds and pins full-screen sections, or print it with Ctrl+P after adding a short @media print block. Choose “Print” for selectable text.

Step 1: get the HTML out of ChatGPT canvas

ChatGPT’s canvas can write a complete web page: a report, a dashboard, a CV or a landing page. What you need for a PDF is that code as a real .html file on your computer. The same applies to pages made in Gemini’s Canvas or as an HTML artifact in Claude.

  1. In the canvas, use the copy option to copy the code, or the download option if it is offered.
  2. If you copied it, paste it into a plain text editor (Notepad on Windows; TextEdit on Mac after Format → Make Plain Text) and save it as page.html in UTF-8.
  3. Double-click page.html. It should open in your browser and look like the canvas preview.
  4. If the code is a React component instead of a page, ask: “Give me this as one self-contained HTML file I can open in a browser.”

Why the PDF looks different from the preview

AI-generated pages are built for the screen. They load styles and libraries from CDNs at runtime, animate things into view and size sections to the window. A PDF is a fixed, paged snapshot, so five things go wrong again and again. Our free converter for AI-generated HTML has a fix for each of them, and you can also fix them in the code.

The Tailwind CDN has not finished styling the page

Many AI pages use the Tailwind Play CDN script, which generates the CSS in the browser after the page loads. Capture too early and you get unstyled text. The fix is simply to wait a few seconds before capturing or printing. For more on Tailwind, read export a Tailwind page to PDF.

Charts are captured mid-animation

Chart.js and similar libraries animate bars and lines from zero. A screenshot taken during that half second shows empty or half-drawn charts. Wait longer, or turn animations off (code below).

The dark theme turns white

Browsers drop background colours when printing unless “Background graphics” is ticked, so a dark dashboard becomes light grey text on white. print-color-adjust: exact or the background option keeps it.

The 100vh hero eats a whole page

Sections sized with 100vh (h-screen in Tailwind) depend on the window height. On paper they can fill a full page with mostly empty space, or be cut. Pin them to the page height or set them to auto height for print.

Fixed headers repeat and scroll-reveal content is invisible

A position: fixed navigation bar can print on every page in Chrome, covering text. Content that fades in on scroll stays invisible because nobody scrolled. Show headers once and force the hidden content to appear.

Check the images, fonts and data the page needs

An AI-generated page often depends on files that are not inside it. Before exporting, open it in your browser and look for broken image icons, fallback fonts or empty panels. Each has a different cause.

Recommended settings by type of page

These starting points work for most pages generated by an AI. If something is still missing, raise the wait time first.

Page typePage sizeBest outputWait before capture
Report, article, CVA4 or US Letter, portraitPrint / Save as PDF (selectable text)1-2 s, more with Tailwind CDN
Dashboard with chartsA4 landscapeDownload PDF, or Print with charts not animated3-5 s
Landing pageA4 portrait, or a full-page PNGDownload PDF or image2-3 s
Slide deck16:9 slidesPDF or PowerPoint2-3 s
Invoice or formA4 or US LetterPrint / Save as PDF1 s

Step 2: convert it in your browser

The free AI HTML converter runs entirely in your browser: the file is opened in a sandboxed frame and is never uploaded, with no sign-up and no watermark. It exports to PDF, PowerPoint, PNG/JPG, Word and Markdown from the same screen.

  1. Drop page.html, paste the code, or drop a .zip if the page uses local images or fonts.
  2. Choose the page size and orientation from the table above.
  3. Set “wait N seconds” to 3 or more for pages using the Tailwind CDN or Chart.js.
  4. Leave the fixes on: animations frozen at their end state, scroll-reveal content shown, fixed headers shown once, 100vh sections pinned to the page height, dark backgrounds kept.
  5. Click “Print / Save as PDF” for real text, or “Download PDF” for a pixel-faithful copy where the text is an image.

Step 3 (optional): ask the AI to add print CSS

If you will print the page more than once, fix it at the source. Paste this request into the same ChatGPT conversation (it works the same in other assistants):

Add print styles to this page so it exports cleanly to PDF.
Do not change how it looks on screen.
- an @page rule: A4 portrait, 12 mm margins
- inside @media print:
  - keep background colours (print-color-adjust: exact)
  - hide the navigation bar, buttons and form controls
  - make fixed or sticky elements position: static
  - replace full-screen heights (h-screen, min-h-screen, 100vh) with auto
  - avoid page breaks inside cards, tables, charts and images
  - disable animations and transitions; show scroll-reveal content
- create every chart with animation: false
@page { size: A4; margin: 12mm; }

@media print {
  html, body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  nav, button, form { display: none !important; }

  /* fixed / sticky headers: print once, at the top */
  .fixed, .sticky, header { position: static !important; }

  /* full-screen hero sections (Tailwind h-screen, 100vh) */
  .h-screen, .min-h-screen { height: auto !important; min-height: 0 !important; }

  /* keep blocks whole */
  section > *, .card, table, tr, canvas, svg, img { break-inside: avoid; }

  /* no half-finished animations, show scroll-reveal content (AOS) */
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-aos] { opacity: 1 !important; transform: none !important; }
}

Turn off chart animations

Animated charts are the most common cause of blank areas in an exported PDF. With Chart.js, one line disables animation for every chart on the page:

// once, before creating the charts (Chart.js 3 and 4)
Chart.defaults.animation = false;

// or for a single chart
new Chart(document.getElementById('sales'), {
  type: 'bar',
  data: { labels: ['Q1', 'Q2', 'Q3'], datasets: [{ label: 'Sales', data: [12, 19, 15] }] },
  options: { animation: false }
});

Print or Download PDF: which button?

If the result still looks wrong, the full troubleshooting guide is why your HTML to PDF looks broken. For a deck rather than a page, see Claude artifact to PowerPoint, and for the general methods, convert HTML to PDF for free.

FAQ

Can ChatGPT export HTML to PDF directly?

The usual route is to copy or download the HTML from the canvas, save it as an .html file, then print it to PDF from your browser or use an HTML to PDF converter. That also lets you fix the layout first.

Why is my PDF unstyled or missing colours?

Either the Tailwind CDN had not generated the CSS yet, so wait a few seconds before exporting, or background graphics were off, so enable them or add print-color-adjust: exact.

Why are my charts empty in the PDF?

They were captured while still animating. Increase the wait time before capture or create the charts with animation: false, which in Chart.js can be set once with Chart.defaults.animation = false.

Which page size should I use for a ChatGPT dashboard?

A4 or US Letter in landscape works for most dashboards. For a page designed as slides, use 16:9. If the layout is still too wide, reduce the scale in the print dialog.

Is my ChatGPT HTML uploaded when I convert it?

Not with an in-browser converter: the file is processed on your device. Fonts, the Tailwind CDN or images that the page itself references are still fetched by your browser, as when you open the file.

Try it: free AI HTML converter

Runs in your browser: no upload, no sign-up, no watermark.

A free tool by Dawwerni, makers of gamified loyalty for local businesses.