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

Performance improvement in PDPageContentStream.drawString

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.2
    • 1.8.3, 2.0.0
    • Writing
    • None

    Description

      There is a simple way of improving the performance of drawString by replacing

      string.writePDF( buffer );
      appendRawCommands( new String( buffer.toByteArray(), "ISO-8859-1"));
      appendRawCommands( SPACE );

      with

      string.writePDF( buffer );
      appendRawCommands( buffer.toByteArray() );
      appendRawCommands( SPACE );

      as the appendRawCommands(String) simple does a appendRawCommands(str.getBytes( "ISO-8859-1" ));
      Therefore this optimization should spare the String creation as well as the conversion back to a byte array.

      Attachments

        1. PDPageContentStreamFast.java
          53 kB
          Philip Helger

        Activity

          People

            lehmi Andreas Lehmkühler
            phax Philip Helger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: