Free Support Forum -

Printing certain pages multiple times

I have a requirement to print the front page of a document (The address) and then print a contract page twice. Is it possible to do this? Can I say something like print pages 1,2,2 to print page 2 twice?

Hi Craig,

Thanks for your interest in our products.

In order to accomplish your requirement, you may try loading the source PDF file twice, from second Document object, get the second page and add it to pages collection of first Document object. Please take a look over the following code snippet to accomplish your requirement.


//open document<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/1916 Nokia.pdf");

// create another document object

Document pdfDocument2 = new Document("c:/pdftest/1916 Nokia.pdf");

// add the second page of second document object to pages collection of first document


//save updated PDF file


Hmmm… Might actually be an idea to do it the other way round - create a PDF with 2 copies of page 2, print it out, then create another PDF with only page 2 and this is the one that gets saved… Will give it some thought!

Hi Craig,

There can be various approaches to fulfill your requirement. One of them can be to load the document and get only the second page of document and save the output file in Stream object. Finally add the page of newly created document object (with second page) and add it to original document.


//open document<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/HTML_PDF_Sample.pdf");

//get particular page

Page pdfPage = pdfDocument.Pages[2];

//create a new document object to hold second page of PDF

Document newDocument = new Document();


// Temporary steam object

MemoryStream temp_stream = new System.IO.MemoryStream();

// save the document object holding 2nd page


// add the page of newly created Document object to original PDF document


// save the final output document with 3 pages


// close the stream object