16
Views
1
Comments
[Ultimate PDF] PDF Header & Footer text menging with Content
ultimate-pdf
Reactive icon
Forge asset by Leonardo Fernandes
Application Type
Reactive
Service Studio Version
11.55.53 (Build 64503)

Hi,

We are using UltimatePDF Forge for PDF generation with configured header and footer sections. After enabling Content Security Policy (CSP) in the environment, we started facing a layout issue in the generated PDFs.

Currently, both the header and footer are overlapping with the main content area instead of maintaining proper spacing and alignment. 

Kindly review the attached screenshot for reference and help us identify the root cause and possible resolution.



Hoping for your assistance.


Thanks.

2026-03-20 01-28-51
Saugat Biswas

Hi @Vijay Dhasnamoorthy,

UltimatePDF uses a Chromium-based rendering engine to convert an HTML screen into PDF. The layout logic for header, main content, and footer spacing relies heavily on: 

  • CSS margin calculations 
  • Runtime measurement of header/footer height 
  • Injected JavaScript used internally by the component to compute offsets 

When Content Security Policy (CSP) is enabled at the environment level, one or more of these internal mechanisms can be blocked. 

This causes: 

  • Header/footer height to be calculated as 0 or auto 
  • Main content to start at the top of the page 
  • Result: content overlaps header/footer

From UltimatePDF’s own implementation and documentation: 

  • It injects inline styles and scripts during rendering 
  • It relies on runtime DOM measurement 
  • CSP policies that block: 
    • unsafe-inline styles 
    • unsafe-inline scripts 
    • blob: or data: sources 
      will silently break layout calculations

Recommended resolution

Update CSP to allow inline styles:

HTTPstyle-src 'self' 'unsafe-inline';

  • This is commonly sufficient
  • Low security risk (styles only)
  • Resolves header/footer overlap in most cases

Hope this helps,

Cheers.

Saugat

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.