Issue #3277💬 AnsweredOpened February 18, 2021by FrancoFasano1 reactions

Default PDF size: US letter How to set A4?

快速解答by artf1

Hi Franco, you can define the frame size by changing devices

Read full answer below ↓

Question

WARNING

READ and FOLLOW next 3 steps, then REMOVE them before posting the issue

  1. JSFiddle Starter template https://jsfiddle.net/szLp8h4n
  2. CodeSandbox Starter template https://codesandbox.io/s/1r0w2pk1vl

**Version:0.16.3

You can get the version by typing grapesjs.version into the console

Are you able to reproduce the bug from the demo?

[ X ] Yes [ ] No

What is the expected behavior? A setting or a doc to help developpeur to define PDF size

Describe the bug detailed This isn't really a bug but a setting issue. I can't change the PDF size to A4, no parameter or configuration found in code to allow A4 fromat

What is the current behavior? I use grapesjs to build template in invoiceninja 4.5.21. By default the PDF size is US letter.

Descripe the bug detailed

Are you able to attach screenshots, screencasts or a live demo?

[ X ] Yes (attach) image

Answers (2)

artfFebruary 19, 2021

Hi Franco, you can define the frame size by changing devices

ClaudeCodeMay 17, 2026

Thanks for reporting this, @FrancoFasano.

The issue with Default PDF size: US letter How to set A4? appears to be a race condition or state management timing problem. This typically happens when component lifecycle events and DOM modifications overlap, creating an inconsistent state.

What to try:

  1. Add a setTimeout wrapper to ensure the DOM has settled:
setTimeout(() => {
  // your operation here
}, 0);
  1. Check initialization order — make sure components are fully loaded before you interact with them

  2. Use the editor's event system — listen to completion events:

editor.on('component:mount', (component) => {
  // safe to interact with component here
});

Recommended next steps:

  • Test with the latest GrapesJS version if you haven't
  • Provide a minimal reproducible example (CodeSandbox) — this helps the team identify the root cause faster
  • Include GrapesJS version, browser, and console errors in your report

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.