# How to make ChatGPT create a downloadable PDF

Can ChatGPT create PDFs? Yes. Copy-paste prompts for a downloadable PDF, how to style it with HTML and CSS, and how to export a chat to PDF.

**Quick answer.** For a well-designed PDF, connect the html-pdf.com MCP server in ChatGPT developer mode with the server URL `https://html-pdf.com/mcp?api_key=hp_live_...` (no authentication). Then ask "Use html-pdf to turn this into an A4 PDF" and ChatGPT returns a download link.

ChatGPT can create a PDF file you can download, but how good it looks depends on how it builds the file. This guide covers the three ways people do it, with prompts you can copy. It also covers what to do when the result looks plain or breaks.

## Can ChatGPT create PDFs?

Yes, when it can run code. ChatGPT can write a short Python program in its built-in code tool, generate the PDF with a library such as ReportLab or FPDF, and give you a download link in the chat.

If you only get text back, or ChatGPT says it can't make files, the code tool probably isn't available in that chat or plan. Ask it directly, "Can you run Python in this chat?"

## Method 1: ask ChatGPT to generate the PDF file

This method gets you a PDF straight from ChatGPT's code tool. Be explicit that you want a file, not text.

> Create a downloadable PDF from the content below. Use Python with ReportLab. A4 page, 2 cm margins, a bold title, a table with the line items, and page numbers in the footer. Give me the download link when it's done.

Here is what to expect.

- **It works well for simple documents** such as letters, checklists, short reports and tables.
- **Layout is drawn by code**, not designed. ReportLab and FPDF place text and boxes one by one, so complex layouts, custom fonts and non-Latin scripts often come out wrong. If the text shows black boxes, ask ChatGPT to embed a Unicode font such as DejaVu Sans.
- **Download links expire.** Files from the code tool aren't kept forever, so download the PDF right away.

## Method 2: ask for HTML, then print it to PDF yourself

This method gives you a better-looking PDF for free, with a few manual steps. ChatGPT is much better at writing HTML and CSS than at drawing PDFs with Python. For anything that should look designed (a resume, an invoice, a one-pager), ask for a single HTML file.

> Write a single, self-contained HTML file for a one-page resume using the content below. Inline all CSS. Use `@page { size: A4; margin: 15mm }`, a two-column layout with CSS grid, and no external images.

Save the answer as `resume.html` and open it in Chrome. Press Ctrl+P (Cmd+P on Mac), choose **Save as PDF**, turn on **Background graphics** and turn off **Headers and footers**.

You get a real PDF with selectable text. This is free and reliable, but you have to do it by hand every time.

## Method 3: connect a PDF tool so ChatGPT returns the PDF itself

This method gives the cleanest result because it combines both. ChatGPT writes the HTML, and a rendering service turns it into a PDF in headless Chromium, the same engine as Chrome's "Save as PDF". With the html-pdf.com MCP server connected, ChatGPT calls the `html_to_pdf` tool and gives you a link to the finished file.

1. Get a free key (100 credits, 1 credit = 1 page) at https://html-pdf.com/login.
2. In ChatGPT, turn on **developer mode** and create an MCP app with the server URL `https://html-pdf.com/mcp?api_key=hp_live_...` and no authentication. Developer mode isn't available on the Free plan, and workspace admins may need to allow it first.
3. Enable the app in a new chat and ask:

> Use html-pdf to turn this into a two-page A4 report with a cover title, a styled table and "Page X of Y" in the footer.

ChatGPT can also convert a public web page with `url_to_pdf`, and check your balance with `get_credits`. For step-by-step screens, see the [ChatGPT setup guide](https://html-pdf.com/guides/chatgpt).

## Prompts that get better PDFs

Add these instructions to your prompt for cleaner, print-ready output.

- **Name the page size and margins**, for example "A4, 15 mm margins" or "US Letter, 0.75 in margins".
- **Ask for print CSS**, for example "Use `break-inside: avoid` on table rows and cards so nothing splits across pages."
- **Ask for page numbers**, for example "Add a footer with Page X of Y."
- **Keep it self-contained**, for example "Inline all CSS and use absolute https URLs for any images."
- **Say what it is for.** "This is printed and handed out" gets more conservative colors than "this is a slide-like PDF for screens".

## How to export a ChatGPT conversation to PDF

Saving the chat itself is a different job from making a document. These are the simple options.

- **Print the page.** Open the conversation in a desktop browser, press Ctrl+P / Cmd+P, and choose Save as PDF. Long chats may need a few tries to load fully first.
- **Use your data export.** ChatGPT's settings let you export your data, which arrives as a zip with your conversations as HTML and JSON. Open the HTML and print it.
- **Ask ChatGPT to reformat it.** Ask "Turn our conversation above into a clean HTML document with headings for each question", then make a PDF from that with Method 2 or 3.

## For developers: create PDFs from your own ChatGPT app

If you call the OpenAI API in your own product, you can turn model output into a PDF with one HTTP request. Have the model write HTML and send it to the API.

```python
import os, requests

html = "<h1>Weekly report</h1><p>...</p>"  # e.g. generated by the model
r = requests.post(
    "https://html-pdf.com/v1/pdf",
    headers={"Authorization": f"Bearer {os.environ['HTML_PDF_KEY']}"},
    json={"html": html, "format": "A4", "margin": "15mm", "response": "url"},
    timeout=60,
)
r.raise_for_status()
print(r.json()["url"])  # download link, valid for 24 hours
```

Failed renders cost nothing, and your HTML isn't stored. See [HTML to PDF in Python](https://html-pdf.com/html-to-pdf-python), the [API docs](https://html-pdf.com/docs) and the [MCP server](https://html-pdf.com/mcp). Using Claude instead? Read [how to make Claude create a PDF](https://html-pdf.com/claude-create-pdf).

## FAQ

### Can ChatGPT create a PDF for free?

Yes, in two ways. If the code tool is available, ChatGPT can build a simple PDF with Python, or you can ask for HTML and save it as PDF from Chrome. html-pdf.com also gives you 100 free credits once, with no card, for well-designed PDFs straight from the chat.

### Why does ChatGPT say it can't create PDF files?

The code tool is probably not available in that chat or plan. Ask for an HTML file instead and print it to PDF, or connect a PDF tool through MCP.

### How do I add page numbers to a ChatGPT PDF?

Ask for "a footer with Page X of Y" in your prompt. With the html-pdf.com tool, the footer uses `pageNumber` and `totalPages` placeholders.

### How long do the download links last?

Links from html-pdf.com last 24 hours, and your HTML is not stored. Files from ChatGPT's own code tool also expire, so download them right away.
