XSCREENSAVER / 3D PIPES

[readonly] markdown buffer

Blob.toPdf() Rendering Changes in Summer '26

Apr 28, 2026 · 6 min read

Summer '26 enforces the release update that makes Blob.toPdf() use the Visualforce PDF rendering service. The Apex signature does not change, but the generated document can.

That matters because PDFs are often invoices, statements, certificates and customer letters. A renderer change is a visual migration even when the code still compiles.

Five checks before activation

1. Make the page rules explicit

The renderer changes the default font from sans-serif to serif. A different font can turn one page into two or move a total below a break.

Set the basics rather than accepting defaults:

<style>
  @page { size: A4; margin: 16mm 14mm; }
  body {
    font-family: sans-serif;
    font-size: 11px;
    line-height: 1.35;
    color: #111;
  }
  h1 { font-size: 18px; margin: 0 0 12px; }
</style>

Generic supported font families are safer than assuming browser-style font discovery.

2. Lock down tables

Financial documents usually fail at line-item tables rather than headings. Set table layout, column widths, padding and alignment. Prevent row breaks where splitting a line would be confusing.

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 4px 3px; vertical-align: top; }
.description { width: 52%; }
.quantity { width: 10%; text-align: right; }
.amount { width: 20%; text-align: right; }
tr { page-break-inside: avoid; }

For documents with contractual meaning, do not let the renderer negotiate critical columns for you.

3. Test real multilingual text

Better multibyte support is one benefit of the new renderer, but the selected font still matters. Build a canary containing the scripts your organisation actually sends, including bold and italic variants.

Do not validate multilingual output with one “hello world”. Use production-like names, addresses and paragraphs in Japanese, Chinese, Arabic, Thai or whichever scripts matter to the document.

4. Compare layout canaries

Generate the same document before and after the update, then compare:

  • page count and final content on each page
  • long addresses and free-text wrapping
  • table row splits
  • headers, footers and signature blocks
  • multilingual characters
  • bold and italic rendering

Visual regression is the test here. An Apex assertion that the returned Blob is non-empty cannot tell you that a signature moved onto a new page.

5. Centralise repeated rules

If several services call Blob.toPdf(), give them one small HTML shell for page size, margins, fonts, tables and keep-together rules.

public class PdfHtml {
    public static String wrapA4(String title, String bodyHtml) {
        String safeTitle = title == null ? '' : title.escapeHtml4();
        return '<html><head><meta charset="UTF-8" />' +
            '<style>@page{size:A4;margin:16mm 14mm}' +
            'body{font-family:sans-serif;font-size:11px;line-height:1.35}' +
            'tr,.keep-together{page-break-inside:avoid}</style>' +
            '</head><body><h1>' + safeTitle + '</h1>' +
            bodyHtml + '</body></html>';
    }
}

The caller still has to escape dynamic HTML correctly. The wrapper simply stops several teams rediscovering the same rendering defaults.

What to audit first

Find every call site:

rg -n "Blob\.toPdf" force-app/main/default

Prioritise externally sent, signed, archived and compliance-sensitive documents. Check any page that relies on implicit fonts, automatic table widths, long free text or a fixed one-page layout.

The new service is a useful improvement, particularly for multilingual output. The unchanged method signature is the trap: make layout rules explicit and visually compare the documents before the platform changes them for you.

Sources