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

CloseFillNonZeroAndStrokePath operator fails to do the stroke.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6.0
    • Fix Version/s: 1.7.0
    • Component/s: Swing GUI
    • Labels:
      None
    • Environment:
      should make no difference
      Version of PDFBox is 1.6.0

      Description

      When displaying or printing a PDF that uses the CloseFillNonZeroAndStrokePath OperatorProcessor, the stroke is not done.

      This is because the FillNonZeroRule which is executed before the stroke calls PageDrawer.fillPath(), which does a reset of the path via getLinePath().reset().
      After the reset, the path is empty, so the stroke operation just does nothing.

      I helped myself by changing CloseFillNonZeroAndStrokePath.java like this:

      public void process(PDFOperator operator, List<COSBase> arguments) throws IOException {
      context.processOperator( "h", arguments );
      // clone the path
      PageDrawer pd = (PageDrawer) context;
      GeneralPath p = (GeneralPath)pd.getLinePath().clone();
      context.processOperator( "f", arguments );
      // and restore before calling stroke
      pd.setLinePath(p);
      context.processOperator( "S", arguments );
      }

      This seems like a hack, so you guys probably know a cleaner way to fix this.

        Attachments

          Activity

            People

            • Assignee:
              lehmi Andreas Lehmkühler
              Reporter:
              spheenik Martin Schrodt
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: