Menu

#17 Several ContentWriter bugs

v1.0 (example)
accepted
nobody
None
5
2014-11-06
2013-06-19
xiperware
No

The following code can break a pdf file by changing its content to something invalid.

CSequence content = ContentReader.ReadContent( page );
byte[] data = content.ToContent();
page.Contents.Elements.GetDictionary( 0 ).Stream.Value = data;
doc.Save( outputFile );

1) CArray with multiple CReals are not seperated with spaces

Old: [6.1048 6.1048 ]0 d
New: [6.10486.1048]0 d

(My fix: move the '+ " "' in CInteger and CReal from WriteObject() to ToString())

2) CReal's of sufficient precision are converted to scientific notation

Old: .017701 .089784 .91061 .000031 k
New: 0.017701 0.089784 0.91061 3.1E-05 k

(My fix: add format "0.0#########" to CReal.ToString())

Discussion

  • PDFsharp Team

    PDFsharp Team - 2013-06-19

    Thank you for the bug fixes, they are on the list for the next major update.

    Re second fix:
    It seems that "#.0#########" would sometimes save a byte (but I didn't test it yet).

     
  • PDFsharp Team

    PDFsharp Team - 2013-06-19
    • status: open --> accepted
     
  • PDFsharp Team

    PDFsharp Team - 2014-11-06

    Thank you very much for your feedback.
    The fix for 2 will be included in the next release.

    We think that your fix for 1 is not the cleanest solution. I think the fix should be made with CArray or CSequence. Can you provide a PDF file and may some (more) code that allows us to replicate the problem?

     

Log in to post a comment.