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

Preflight cookbook example is inefficient

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.10, 1.8.11
    • Fix Version/s: 1.8.11
    • Component/s: Documentation
    • Labels:
      None

      Description

      The example shown in
      http://pdfbox.apache.org/1.8/cookbook/pdfavalidation.html
      passes a DataSource object. This results in the creation of a temporary file. The constructor with the DataSource makes only sense when working with URLs. (And that only if http is cached, because preflight does an openStream() for each PDF stream!)

      It would be better to replace

      FileDataSource fd = new FileDataSource(args[0]);
      PreflightParser parser = new PreflightParser(fd);
      

      with

      PreflightParser parser = new PreflightParser(args[0]);
      

      Edit: removed 2.0, as the example may have to change after solving PDFBOX-3007.

        Attachments

          Activity

            People

            • Assignee:
              lehmi Andreas Lehmkühler
              Reporter:
              tilman Tilman Hausherr
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: