Hi,
I have soem classes, each of which create a seperate printout, sometimes, these printouts need to be combined. I know I could save the files, then combine them into one PDF, but it would be better if I could just combine the PdfDocument objects into one PdfDocument object and then save this.
Is there a way? the samples only seem to cover combining saved files.
I am currently trying to do it with a function like this:
Code:
public PdfDocument combineDocs(PdfDocument doc1, PdfDocument doc2)
{
PdfDocument _combinedDoc = new PdfDocument();
for (int i = 0; i < doc1.PageCount; i++)
{
try
{
_combinedDoc.InsertPage(_combinedDoc.PageCount + 1, doc1.Pages[i]);
}
catch
{
}
}
for (int q = doc1.PageCount; q <= doc2.PageCount; q++)
{
_combinedDoc.InsertPage(_combinedDoc.PageCount + 1, doc2.Pages[q]);
}
return _combinedDoc;
}
but this errors saying i need to set PdfDocumentOpenMode to modify - and this enumerator only seems to be needed when opening a saved file, rather than when manipulating PdfDocument objects.
is what I am trying to do possible? or do I have to save each document, then combine them as per the samples?
thanks!
Mike