PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Fri Sep 05, 2025 3:47 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Oct 17, 2012 9:31 pm 
Offline

Joined: Thu Apr 19, 2012 1:53 pm
Posts: 2
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();


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 18, 2012 8:15 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3135
Location: Cologne, Germany
Hi!
ronyz wrote:
Any solution would be really appreciated.
There is nothing we can do without a PDF file that causes this error message.
Confidential PDF files can be submitted via e-mail (or just scan something that is not confidential).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 436 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group