Generate PDF Using Apex Without Visualforce | Spring ’26
If you have ever tried to generate a PDF using Apex in Salesforce, you know the limitations that came with it. Without a Visualforce page, creating a PDF was not possible, and in many cases, teams had to rely on paid third-party tools.
Even when all the business logic was written in Apex, Visualforce was still required behind the scenes just to handle PDF rendering. The Spring ’26 Salesforce release changes this behaviour and introduces a better way to generate PDFs directly using Apex.
How to Generate a PDF Using Apex Without a Visualforce Page?
Here’s what actually happens now. Apex builds the content as HTML, and that HTML is passed into Blob.toPdf().

Below is a complete Apex example that builds HTML in code, converts it into a PDF using Blob.toPdf() and automatically attaches the generated PDF to the related Account record as a File.
Salesforce now renders the PDF directly and returns it as a Blob, without requiring a Visualforce page. There is nothing extra to deploy or reference in your org.
Behind the scenes, Salesforce still uses the same PDF rendering engine that powered Visualforce PDFs for years. This makes the experience feel entirely Apex-based, while the platform continues to handle the rendering quietly in the background.
What Did Not Change in Apex PDF Generation Logic?
Your Apex code stays the same.
- Blob.toPdf() still takes a string
- It still returns a Blob
- Existing implementations keep working
Example Output: PDF Generated Using Apex Without a Visualforce Page
Below is an example of a PDF created using Apex and Blob.toPdf().
All of that comes from HTML and inline styles passed into Apex. Salesforce handles rendering and returns the final PDF. There’s no Visualforce page sitting in the org just for output.

Fonts and Layout Changes in PDFs Generated Using Apex
There is one visual change to be aware of. The Visualforce PDF rendering service supports a wider range of fonts and improved multibyte character handling. As a result, the default font changes from serif to sans-serif.
If your HTML doesn’t explicitly define font styles, you might notice small layout differences:
- Line lengths are changing slightly
- Page breaks moving
- Text wrapping differently
Nothing breaks, but layout-sensitive PDFs should always define fonts explicitly. That avoids surprises later.
When is the apex PDF rendering update planned to be enforced?
Salesforce plans to enforce this change in Summer ’26. You don’t need to wait until then. You can enable the update early from Release Updates in Setup and review how your existing PDFs render.
That gives you time to adjust styling if needed, instead of finding out during enforcement.
Best Use Cases for Generating PDFs Using Apex Without Visualforce
Generating PDFs directly from Apex makes sense in places like:
- Record summaries
- Invoices or statements
- Approval documents
- Flow-driven document creation
- Scheduled or background reports
Removing Visualforce pages from these flows keeps solutions simpler and easier to maintain over time. Before enabling the update in production, it’s smart to review:
- Page breaks
- Headers and footers
- Tables and borders
- Font alignment
Also Read – Preview a File in a Screen Flow | Spring ’26 Release
FAQs
1. Can I generate a PDF in Salesforce using Apex without creating a Visualforce page?
Yes. With the updated behavior of Blob.toPdf(), you can generate PDFs using Apex alone. You pass HTML content to Apex, and Salesforce renders the PDF using the Visualforce PDF rendering service behind the scenes, without requiring a Visualforce page in your org.
2. How does Blob.toPdf() work in Spring ’26?
In Spring ’26, Blob.toPdf() uses the same rendering engine that Visualforce PDFs use. The method signature stays the same, but Salesforce routes the rendering through the Visualforce PDF service to ensure consistent output and better font support.
3. Does this change break existing Apex PDF generation code?
No. Existing Apex code that uses Blob.toPdf() continues to work. The change only affects how the PDF is rendered internally. You don’t need to modify your Apex logic unless your PDF layout depends on default font behavior.
4. Why does my PDF layout look slightly different after enabling the update?
The Visualforce PDF rendering service uses a different default font. If your HTML doesn’t explicitly define font styles, text wrapping and page breaks may shift slightly. Defining fonts in your HTML prevents these differences.
5. When is the Blob.toPdf() rendering update enforced?
Salesforce plans to enforce this update in Summer ’26. You can enable it earlier from Release Updates in Setup to test existing PDFs before enforcement.
Conclusion
Spring ’26 makes PDF generation in Salesforce quieter and cleaner. You can now generate PDFs using Apex without a Visualforce page while still relying on the same rendering engine Salesforce uses for Visualforce PDFs. The platform takes care of consistency. Your code stays focused on logic.
If your org creates PDFs through automation or backend logic, this update is worth enabling early and testing with confidence.
