I am trying to append a pdf document to another document. I am using PdfCopy
to do this.
The result I am getting is that the src file is getting copied over the
destination file instead of appending to it.
Below is the src code that I am using.
public int AppendPages(String aSrcFileName, String aDestFileName)
PdfReader aReader;
iTextSharp.text.Rectangle size;
PdfCopy aCopier;
FileStream aDestFileStream;
Document Doc;
try
{
aReader = new PdfReader(aSrcFileName);
size = aReader.GetPageSizeWithRotation(1);
Doc = new Document(size);
aDestFileStream = new FileStream(aDestFileName, FileMode.Append);
aCopier = new PdfCopy(Doc, aDestFileStream);
Doc.Open();
for (int i = 1; i <= aReader.NumberOfPages; i++)
{
Doc.NewPage();
aCopier.AddPage(aCopier.GetImportedPage(aReader, i));
}
Doc.Close();
aReader.Close();
return 1;
}
catch (Exception e)
{
//LogException(e);
return 0;
}
}
Can anyone please let me know what is missing.
Thanks,
Rajani
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/