PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error in Parser.ReadTrailer()

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Bug Reports - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
wmausz



Joined: 10 Dec 2007
Posts: 1

PostPosted: Mon Dec 10, 2007 12:05 pm    Post subject: Error in Parser.ReadTrailer() Reply with quote

Hello!

In one of my projects I have to merge PDF files (produced by SAP) into one big PDF. I tried your library and found a bug in either the library or (also possible) the PDFs I have to merge.

In the function ReadTrailer() you are reading the last 30 bytes and then you search for the startxref symbol. My PDFs I got for testing have a lot of \0 bytes at the end (more than 30! ) which will make it impossible for your ReadTrailer-function to find the requested symbol. I corrected the function to be able to read my PDFs from SAP in the following way:

internal PdfTrailer ReadTrailer()
{
//Symbol symbol;
//string token;
//int xrefOffset = 0;
int length = lexer.PdfLength;

// YOUR ORIGINAL CODE --> COMMENTED OUT
//string trail = this.lexer.ReadRawString(length - 31, 30); //lexer.Pdf.Substring(length - 30);
//int idx = trail.IndexOf("startxref");

// SCANNING THE WHOLE DOCUMENT FOR THE LAST startxref -> will also work if bytes are added at the end
string trail = this.lexer.ReadRawString(0, length);
int idx = trail.LastIndexOf("startxref");

//this.lexer.Position = length - 31 + idx;
this.lexer.Position = idx;

ReadSymbol(Symbol.StartXRef);
this.lexer.Position = ReadInteger();
...

I just wanted to give a feedback to this problem, maybe it is useful for you and you can consider it for future versions.

Bye,

Wilfried Mausz
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Bug Reports - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com