View previous topic :: View next topic |
Author |
Message |
aknuth
Joined: 23 Mar 2007 Posts: 16 Location: Berlin
|
Posted: Fri Aug 17, 2007 6:26 pm Post subject: Generated PDF Errors |
|
|
Hello,
I used migradoc 1.2.1930.0 and pdfsharp 0.9.653.0 to create a pdf file. However I cannot import that pdf file using pdflib as it says it contains errors.
Furthermore when I open the pdf file using Adobe Acrobat, the file is being repaired. After that I installed another analyzing tool that spit out the following errors:
2x The end-of-file marker was not found.
1x The 'startxref' keyword or the xref position was not found.
If somebody got a clue or might be able to help me, I can send the "corrupted" pdf for further examination. Just cannot post it here as it contains internal information.
Regards,
André |
|
Back to top |
|
|
aknuth
Joined: 23 Mar 2007 Posts: 16 Location: Berlin
|
Posted: Sat Aug 18, 2007 3:26 pm Post subject: |
|
|
Something to add:
After trying to open the generated PDF using PdfReader.Open I get the following error:
Code: | PdfSharp.Pdf.IO.PdfReaderException: Token '' was not expected.
bei PdfSharp.Pdf.IO.Parser.ReadSymbol(Symbol symbol) in D:\Projects2\delivergo\PDFSharp 1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf.IO\Parser.cs:Zeile 541.
bei PdfSharp.Pdf.IO.Parser.ReadTrailer() in D:\Projects2\delivergo\PDFSharp 1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf.IO\Parser.cs:Zeile 711.
bei PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider) in D:\Projects2\delivergo\PDFSharp 1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf.IO\PdfReader.cs:Zeile 275.
bei PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode) in D:\Projects2\delivergo\PDFSharp 1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf.IO\PdfReader.cs:Zeile 247.
bei PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, PdfDocumentOpenMode openmode) in D:\Projects2\delivergo\PDFSharp 1.0.898\PDFsharp\PdfSharp\PdfSharp.Pdf.IO\PdfReader.cs:Zeile 232. |
Regards,
André |
|
Back to top |
|
|
aknuth
Joined: 23 Mar 2007 Posts: 16 Location: Berlin
|
Posted: Sun Aug 19, 2007 4:44 pm Post subject: |
|
|
Hi there,
I produced the fault on my own, but I want others to not run into the same problem. I used a MemoryStream to save the generated document in. Later on I need a byteArray out of that(for a webservice).
To get the byteArray I used the Code: | memoryStream.GetBuffer() | method of the MemoryStream which unfortunately gets the whole buffer INCLUDING zero padding at the end of the stream. So that is what produced the "corrupted" pdf files.
MemoryStreams grow dynamically and when the size is being increased the yet unused space is filled with zeros. So better use Code: | memoryStream.ToArray | for small amount of data or something like Code: | fileStream.Write(memoryStream.GetBuffer(), 0, memoryStream.Position); | when using big files.
Regards,
André |
|
Back to top |
|
|
|