0

We are facing an issue while generating the PDF file in our VB .Net code using iTextSharp (version 5.0.2.0). We need to have different pages with different width in our PDF document having, first and second page with standard width and height while, starting from third page, the page width should be increased by 20% more comparing with first and second page. When we set the page’s width to be increased, the contents on the page got cut off/slides to the right side of the page. Is there any way to set the different pages width and get the contents centrally aligned? The code we have used to get the page width increased is:

PdfDocument.NewPage()
Dim pgSize As New iTextSharp.text.Rectangle(700, 792)
PdfDocument.SetPageSize(pgSize)

Please suggest any solution on this.

mkl
  • 90,588
  • 15
  • 125
  • 265
  • 2
    How are you adding content to the PDF? Are you using direct content or the abstraction such as `Paragraph` and `Table`? Did you set any margins on the document? – Chris Haas Aug 14 '15 at 13:28
  • 1
    This is a possible duplicate of [iText create document with unequal page sizes](http://stackoverflow.com/questions/23117200/itext-create-document-with-unequal-page-sizes). When done correctly, this problem doesn't occur. You need to add `PdfDocument.NewPage()` after using the `SetPageSIze()` method. In old version (such as 5.0.2.0 dating from April 13, 2010!), odd things can happen when you don't create a new page. This should be solved in more recent versions. (So why not upgrade?) – Bruno Lowagie Aug 14 '15 at 13:40

0 Answers0