views:

350

answers:

2

I'm trying to copy a PDF using ABCpdf's AddImageDoc. Doesn't look like any document properties (like "/Rotate") get copied along. It looks like I have to copy these properties manually from old document to new using SetInfo method. Like so:

foreach page...{
    newPdfDoc.Page = newPdfDoc.AddPage();
    newPdfDoc.AddImageDoc(existingPdfDoc, i, null);
    newPdfDoc.SetInfo(newPdfDoc.Page, "/Rotate", existingPdfDoc.GetInfo(existingPdfDoc.Page, "/Rotate"))
}

There are bunch of these properties and I don't want to set these manually. Is there a way to copy all the properties all at once?

+1  A: 

ABCPdf does not have an iterator for PDF properties

So unless you know all the property names you want to transfer you will need to use another tool to get the property names. You can use the PDFsharp library to read any low level PDF items

TFD
+3  A: 

Think of Doc.AddImageDoc as a function for placing a page from another document as an image. The Doc.AddImage set of functions basically scale imported images to fit the document's current Rect property.

To combine PDF documents consider using the Doc.Append method.

To copy or delete pages within a document, use the Doc.RemapPages method.

Kitty Zheng
Great! I didn't know about RemapPages
Eduardo Molteni