I need to insert a blank page to an existing PDF using Itextsharp in the end of the PDF if it has odd number of pages. I could sucessfully get the. has a function of adding, removing the blank pages in C#. We have already shown you how to remove the blank page in a PDF file. This article will. The print-ready file I want needs to be duplex, so for the documents I have which are only 1 page, I need to add a blank page for the “back” of the document.
|Published (Last):||19 July 2011|
|PDF File Size:||19.59 Mb|
|ePub File Size:||15.29 Mb|
|Price:||Free* [*Free Regsitration Required]|
Please don’t tell me that making such changes is difficult. Sign up using Facebook. Add new Chunk. Well I was almost there.
Click this link if you want to see how to answer this question in iText 5. NewPage ; at the end of the for loop for an odd number of pages without success. Adding a table didn’t work for me. It seems to make the blank page following each page the orientation and size of the Source PDF Page but the page from the Source PDF seems to be the orientation and size of the previous blank page: Close ; Note that I add the pages in reverse order.
Forums – C# Corner
Using the InsertPage method you can add pages of any size you want: You changed your question saying that you need a C example because you don’t know how to change a c into a C and a i into an I? Width, 0 ; break; default: I know PdfWriter can easily add blank pages, but it isn’t made for merging a large number of files, which is why I’m not using it.
Add fileRef ; document. Why would you ignore the official iText web site and give preference to examples from people who don’t know the first thing about iText???
blank page not added in pdf using itextsharp
Sign up using Email and Password. So you probably need an instance of source PdfDocument and a few lines of code:. Using the InsertPage method you can add pages of any size you want:. AddTemplate page1, 0, -1f, 1f, 0, 0, psize. GetInstance document, pdfStreamOut ; document. Sign up or log in Sign up itxetsharp Google. Skip to main content. Another alternative that works successfully. It’s easier do go in the reverse direction. Change some lower cases in upper cases such as change close to Close and insertPage to InsertPage and you have your solution.
Maybe due to a newer version of ITextSharp.
Would you be so kind as to provide a link? It seems to make the blank page following each page the orientation xdd size of the Source PDF Page but the page from the Source PDF seems to be the orientation and size of the previous blank page:.
c# – How to add a blank page to a pdf using iTextSharp? – Stack Overflow
Sign up or log in Sign up using Google. Sign up using Facebook. Please do not mark this as duplicate as it is not a duplicate question. This is elementary logic: Sign up using Email and Password. Here is the basic code I have at the moment for merging all of the letters: The example you provided is in Java and it’s only for the paage page of the document.
How to add blank pages while concatenating several PDFs using PdfSmartCopy | iText Developers
Note that I add the pages in reverse order. Here is the code that will add a blank page if the document I ad merging has an odd number of pages: I can confirm that for newer version you should add a Chunk instead of a table.
Thanks for the update – this was quite a while ago. How to add a blank page to a pdf using iTextSharp?