Q: I have a document where I want to have two copies of the same page
and want to add different information on each of them.
My problem is that the information is put on the two pages instead of
I guess I need to copy the data to a new page but I haven’t found a
Can you point me in the right direction?
A: When duplicating pages within the same document, PDFNet keeps the
reference to the same content stream and resources to keep the file
size down. In case you would like to fully replicate all information
when duplicating page you can use the following technique:
PDFDoc tmp_doc = new PDFDoc();
This way you can stamp replicated pages with different content.
Q: Thank you for taking the time to help me.
I have successfully duplicated a page using the following code
Page oNewPage = oDocument.PageCreate (oPageToCopy.GetMediaBox ());
ElementReader oReader = new ElementReader ();
ElementWriter oWriter = new ElementWriter ();
while ((oElement = oReader.Next ()) != null)
Using this way I don't have to copy from one document to another and
hence having maximum efficiency since only a small fraction of the
pages need to be duplicated.
What do you think of this method? It seems to do the job as I get the
result I want.
Can you confirm this is a good way to do it?
A: The only problem is that you may lose existing page annotations
(since you are only copying page content element and not annotations).
Also a possibly better (more efficient) approach would be to copy the
page content using builder.CreateForm(src_page, new_doc) as shown in
Imposition sample project (http://www.pdftron.com/net/