Skip to content

Margin on open document applied only on second page #1282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DarkMike-ru opened this issue Apr 2, 2025 · 2 comments · May be fixed by #1283
Open

Margin on open document applied only on second page #1282

DarkMike-ru opened this issue Apr 2, 2025 · 2 comments · May be fixed by #1283
Labels

Comments

@DarkMike-ru
Copy link

Describe the bug

When your set margin on already open document they applied only on second page for text

To Reproduce

      var document = new Document();
      var writer = PdfWriter.getInstance(document, outputBuffer);
      // step 2: open the document
      document.open();
      document.setMargins(100, 100, 100, 100);
      document.newPage();
      // step 3: add a paragraph to the document
      document.add(new Paragraph("Hello World"));
      document.newPage();
      document.add(new Paragraph("Hello World 2"));
      // step 4: we close the document
      document.close();

Expected behavior

In example we must see two page with same margin

Your real name

Mikhail Mironov

@DarkMike-ru DarkMike-ru added the bug label Apr 2, 2025
@DarkMike-ru
Copy link
Author

Example file
export.pdf

@DarkMike-ru DarkMike-ru linked a pull request Apr 2, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@DarkMike-ru and others