Claude vs ChatGPT for PDF templates
.NET & AI Newsletter · by Mukesh Murugan · 3 min read
If you have asked an AI model to write an HTML template for a PDF, you most likely checked page one and moved on. The problems usually show up on page two, once a long order pushes the table onto the next page. In this issue, I will share what happened when I gave Claude Fable 5.1 and GPT-6 Astra the same invoice prompt.
SPONSORED
IronPDF
Iron Software sponsored this issue and the article. IronPDF is a .NET library that renders HTML and CSS to PDF with a Chrome-based engine, and I used it to render and score every template in this test. You can get a free 30 day trial key with no watermarks, and unlike a sandbox key, it works with a plain dotnet run.
I gave both models the same prompt five times each, in fresh chats, and rendered all 10 templates with IronPDF on .NET 10. A small C# console app then reads the text of each page back and checks whether the header row repeats on page two, whether the subtotal and the grand total share a page, and whether any row gets cut in half.
I expected a few failures, because the template a model wrote for my earlier invoice article did not even have a real @page rule. This time, all 10 templates scored 9 out of 9, and both models wrote the print rules on every run without being asked.
The difference only showed up once I switched off background printing, which is the renderer default. Here are the print rules from one of Claude's templates:
/* Keep background colors when printing */
html {
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
/* Repeat the header row on every page */
table.lines thead {
display: table-header-group;
}
/* Never split a line item across two pages */
table.lines tr {
break-inside: avoid;
page-break-inside: avoid;
}GPT-6 Astra wrote the last two rules every time, but it set print-color-adjust in none of its five runs. In one of them, the grey fill on the header row disappeared as soon as backgrounds were off. Claude set it in all five runs, and its fills survived. If your invoices use colored header bands or shaded totals, this is the one line you should check.
Includes the C# scorer on GitHub, which you can point at any template.
Here is one more for you to think about. Before I trusted the scorer, I ran it against templates where I already knew the answer, and that is how I found two bugs in my own checks. One of them failed every Astra template on the same row, BV-1011, even though that row was perfectly fine in the PDF.
The check was simple. It looked for each row's SKU and description in the text of the page. So why would a correct row fail it in every run? If you write tests that read text back out of a PDF, this one is worth knowing about. The article explains what caused it and how I fixed the check.
The full comparison, with the prompt, the stress tests and which model I would pick for each situation → Claude Fable 5.1 vs GPT-6 Astra: HTML to PDF in C#
Thanks for reading, and happy coding!
- Mukesh
Free courses, always open: .NET Web API: Zero to Hero · Claude Code for .NET Developers