Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
In Version v3.0.4, we have introduced a new method named AddPageBreak()
in the PDFDocument
class. This method behaves like the similar feature in Microsoft Word and other word-processing applications. It inserts a new page and makes it the current page for further content rendering operations. However, the method does this only when it is creating a document. When this method is called after loading an existing document, then no new page is created but the next page is made the current page and the focus of further rendering operations.
To find out how this works, create a Windows Forms project, add two buttons and use the following click-event handlers.
// Illustrates AddPageBreak() behavior in creation mode private void button1_Click(object sender, EventArgs e) { PDFDocument doc = new PDFDocument("your-license-key"); doc.OpenAfterCreate = true; doc.MeasurementUnit = PDFMeasurementUnit.Inches; doc.AutoPaginate = false; PDFFont fontCourier = new PDFFont(StdType1Font.Courier, PDFFontStyle.Fill, 24); for (float i = 1, y=0.5f; i <= 40; i++) { doc.WriteText(i.ToString() + ". I will not litter the classroom. ", fontCourier, 1, y); y += 0.5f; if ( (i % 10 == 0) & (i < 40)) { // Insert a new page doc.AddPageBreak(); y = 0.5f; } } doc.Save("imposition.pdf"); doc.Dispose(); } // Illustrates AddPageBreak() behavior in reading mode private void button2_Click(object sender, EventArgs e) { PDFDocument doc = new PDFDocument("your-license-key"); doc.Load("imposition.pdf"); doc.OpenAfterCreate = true; doc.MeasurementUnit = PDFMeasurementUnit.Inches; doc.AutoPaginate = false; doc.Brush.Color = Color.Red; PDFFont fontCourier = new PDFFont(StdType1Font.Courier, PDFFontStyle.Fill, 24); for (float i = 1, y = 0.5f; i <= 40; i++) { doc.WriteText(" Now, behave! ", fontCourier, 5.5f, y); y += 0.5f; if ((i % 10 == 0) & (i < 40)) { // Move to the next page doc.AddPageBreak(); y = 0.5f; } } doc.Save("imposition_reviewed.pdf"); doc.Dispose(); Close(); }
When you run the application and click on the first button, it will create a PDF document like this. The method AddPageBreak()
creates a new page each time it is called.
When you click the second button, new pages are not created. However, the focus simply moves to the next page and rendering operations resume from there. Thanks to this behaviour, we are able to render content where it was previously left off when the document was first created.
---o0O0o---
Our .NET Developer Tools | |
---|---|
Gnostice Document Studio .NETMulti-format document-processing component suite for .NET developers. |
PDFOne .NETA .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications. |
Our Delphi/C++Builder developer tools | |
---|---|
Gnostice Document Studio DelphiMulti-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms. |
eDocEngine VCLA Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools. |
PDFtoolkit VCLA Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents. |
Our Java developer tools | |
---|---|
Gnostice Document Studio JavaMulti-format document-processing component suite for Java developers. |
PDFOne (for Java)A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications. |
Our Platform-Agnostic Cloud and On-Premises APIs | |
---|---|
StarDocsCloud-hosted and On-Premises REST-based document-processing and document-viewing APIs |
Privacy | Legal | Feedback | Newsletter | Blog | Resellers | © 2002-2025 Gnostice Information Technologies Private Limited. All rights reserved. |