Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1778

Rounding issue in generated PDF file

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.8.3
    • Fix Version/s: 1.8.3, 2.0.0
    • Component/s: PDModel, Signing
    • Labels:
      None

      Description

      We have PDF file which was signed by some other application.
      When we try to sign it with PDFbox, previous revision is damaged.

      We did some investigations and found such problem:
      (question on stackoverflow is here: http://stackoverflow.com/questions/19903884/pdf-document-is-modified-by-another-revision/19905271?noredirect=1#19905271 )

      Some PDF tags are changed in new revisions.
      For example values of following tags:
      /WhitePoint
      /Gamma
      /Matrix
      are changed from values like this: 0.9505
      to values like this: 0.9505000114

      We think this is problem of converting float/double inside COSFloat.

      Following code just opens and saves PDF file and this operation changes values of mentioned text:

      public void saveTo(String sourceFile, String destFile) throws Exception{
      PDDocument doc = PDDocument.load(new FileInputStream(sourceFile));
      doc.save(new FileOutputStream(destFile));
      }

        Attachments

        1. extreme-values-red.png
          102 kB
          Michael Klink
        2. extreme-values-red.pdf
          21 kB
          Michael Klink
        3. extreme-values.png
          218 kB
          Michael Klink
        4. extreme-values.pdf
          4 kB
          Michael Klink
        5. saved.pdf
          3 kB
          vakhtang koroghlishvili
        6. original.pdf
          3 kB
          vakhtang koroghlishvili

          Activity

            People

            • Assignee:
              lehmi Andreas Lehmkühler
              Reporter:
              v.koroghlishvili vakhtang koroghlishvili
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: