I want to clone a PDF file and make some changes to the document at some point during or after copying.
I managed to do this with pages, but I'm trying to copy also all metadata, form fields, acrofields, etc.
How can I do this with iTextSharp?
Document document = new Document();
FileStream fs = new FileStream(OutputFile, FileMode.Create, FileAccess.Write, FileShare.None)
PdfCopy copy = new PdfCopy(document, fs);
document.Open();
for (int i = 1; i <= reader.NumberOfPages; i++)
{
PdfImportedPage importedPage = copy.GetImportedPage(reader, i);
copy.AddPage(importedPage);
}
copy.Outlines = SimpleBookmark.GetBookmark(reader);
fs.Flush();
PdfCopyFields copyf = new PdfCopyFields(fs);
source
share