[ 
https://issues.apache.org/jira/browse/PDFBOX-253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jukka Zitting resolved PDFBOX-253.
----------------------------------

    Resolution: Fixed

[Comment on SourceForge]
Date: 2008-05-27 21:45
Sender: danielwilson
Logged In: YES 
user_id=1737686
Originator: NO

We resolved this a few days ago.

Please grab code from 5/23/08 or later.

Thanks.


> IllegalPathException in FillNonZeroRule.java (nightly build)
> ------------------------------------------------------------
>
>                 Key: PDFBOX-253
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-253
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDFReader
>
> [imported from SourceForge]
> http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1672556
> Originally submitted by nobody on 2007-03-02 08:45.
> Hello,
> I was just trying out the latest build of your project (current release 
> wasn't printing shaded backgrounds) and it crashed with the following 
> exception when trying to print.
> Exception in thread "main" java.awt.geom.IllegalPathStateException: missing 
> initial moveto in path definition
>         at java.awt.geom.GeneralPath.needRoom(GeneralPath.java:144)
>         at java.awt.geom.GeneralPath.closePath(GeneralPath.java:255)
>         at 
> org.pdfbox.util.operator.pagedrawer.FillNonZeroRule.process(FillNonZeroRule.java:71)
>         at 
> org.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:494)
>         at 
> org.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:477)
>         at 
> org.pdfbox.util.operator.pagedrawer.FillNonZeroAndStrokePath.process(FillNonZeroAndStrokePath.java:62)
>         at 
> org.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:494)
>         at 
> org.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:215)
>         at 
> org.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:174)
>         at org.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:105)
>         at org.pdfbox.pdmodel.PDPage.print(PDPage.java:741)
>         at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1785)
>         at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1334)
>         at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1196)
>         at org.pdfbox.pdmodel.PDDocument.print(PDDocument.java:829)
>         at org.pdfbox.PrintPDF.main(PrintPDF.java:108)
> After commenting out line 71 in FillNonZeroRule.java, it printed OK 
> (including shaded background).
>      67         List subPaths = drawer.getLineSubPaths();
>      68         for( int i=0; i<subPaths.size(); i++ )
>      69         {
>      70             GeneralPath subPath = (GeneralPath)subPaths.get( i );
>      71             //subPath.closePath(); 
> <<<<---------------<<<<<<<<<<<<<<<<<<<<<
>      72             graphics.fill( subPath );
>      73         }
>      74         //else
> Thanks
> [comment on SourceForge]
> Originally sent by sector9.
> Logged In: YES 
> user_id=337685
> Originator: NO
> I investigated this a bit further. The error can be avoided by checking the 
> current point of the path before closing it. The getCurrentPoint() returns 
> null only if the path is empty. Applying the following change to both files 
> creates a workaround for this problem.
> diff -r 
> PDFBox-0.7.4/src/org/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java 
> PDFBox-0.7.4-dev-20071030/src/org/pdfbox/util/operator/pagedrawer/FillEvenOddRule.java
> 70,71c70,73
> <             subPath.closePath();
> <             graphics.fill( subPath );
> ---
> >             if (subPath.getCurrentPoint() != null) {
> >                 subPath.closePath();
> >                 graphics.fill( subPath );
> >             }
> [comment on SourceForge]
> Originally sent by sector9.
> Logged In: YES 
> user_id=337685
> Originator: NO
> This error message still occurs in PDFBox-0.7.4-dev-20071030. The exception 
> is thrown only when an empty GeneralPath is closed. A short example:
>     GeneralPath path = new GeneralPath();
>     path.closePath();
> Commenting out the calls to closePath() makes the error disappear but I do 
> not know if failing to close the path affects the way that valid paths are 
> drawn. Correct solution would be to not create empty paths.
> [comment on SourceForge]
> Originally sent by kieselhorst.
> Logged In: YES 
> user_id=1223774
> Originator: NO
> Stacktrace from nightly build 20070712... obviously it's the same problem.
> Exception in thread "main" java.awt.geom.IllegalPathStateException: missing 
> initial moveto in path definition
>  at java.awt.geom.Path2D$Float.needRoom(Path2D.java:263)
>  at java.awt.geom.Path2D.closePath(Path2D.java:1752)
>  at 
> org.pdfbox.util.operator.pagedrawer.FillNonZeroRule.process(FillNonZeroRule.java:71)
>  at org.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:452)
>  at org.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:215)
>  at org.pdfbox.util.operator.pagedrawer.Invoke.process(Invoke.java:182)
>  at org.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:452)
>  at org.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:215)
>  at org.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:174)
>  at org.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:105)
>  at org.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:657)
> [comment on SourceForge]
> Originally sent by benlitchfield.
> Logged In: YES 
> user_id=601708
> Originator: NO
> see barcode_test.pdf

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to