Hi,
i am using pdfsharp.dll to merge pdf documents. Everything seemed to be working until we started merging pdf documents obtained from scanned documents using personnal scanners.
The error is Token '' was not expected.
I tried the following: print the pdf document using pdfcute, then try to merge the resulting print pdf. and it works fine.
It is not an option for us to change scanners

!!!
Did anyone face this issue??? Any solution would be really appreciated.
below is the code i am using (the 2 files are stored in sharepoint):
Stream Stream2 = spfile2.OpenBinaryStream();
Stream Stream1 = spfile1.OpenBinaryStream();
PdfDocument outputDocument = PdfReader.Open(Stream1,PdfDocumentOpenMode.Modify);
PdfDocument inputDocument = PdfReader.Open(Stream2, PdfDocumentOpenMode.Import);
int count = inputDocument.PageCount;
for (int idx = 0; idx < count; idx++)
{
PdfPage page = inputDocument.Pages[idx];
outputDocument.AddPage(page);
}
outputDocument.Save(Stream1, false);
spfile1.SaveBinary(Stream1);
spfile1.Update();
Stream1.Close();
Stream2.Close();
outputDocument.Dispose();
inputDocument.Dispose();