[ 
https://issues.apache.org/jira/browse/PDFBOX-3598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15703968#comment-15703968
 ] 

Yan Bing commented on PDFBOX-3598:
----------------------------------

Hi, Tilman
Thank you very much for your help.
Use snapshot 2.0.4-166(pdfbox-app-2.0.4-20161128.173807-166.jar), it doesn't 
throw this exception.
But another problem comes.

When I get the color space of file pdfbox-test-data1.pdf, it returns DeviceGray.
While I opened it with a text editor (notepad++), I can see the color space 
value is DeviceRGB.

The code block:
      PDGraphicsState state = getGraphicsState();
      System.out.println("Stroke Color Space: " + 
state.getStrokingColorSpace());        ←DeviceGray
      PDColor strokingColor = state.getStrokingColor();
      PDColor nonStrokingColor = state.getNonStrokingColor();
      RenderingMode renderingMode = state.getTextState().getRenderingMode();
      PDColorSpace colorSpace = strokingColor.getColorSpace();
      PDColorSpace ncolorSpace = nonStrokingColor.getColorSpace();
      System.out.println(colorSpace.getName());                  ←DeviceGray
      System.out.println(ncolorSpace.getName());                  ←DeviceGray

> EmptyStackException in PDFStreamEngine.getGraphicsState
> -------------------------------------------------------
>
>                 Key: PDFBOX-3598
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3598
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.3
>            Reporter: Yan Bing
>            Priority: Critical
>         Attachments: pdfbox-test-data1.pdf, pdfbox-test-data2.pdf
>
>
> I try to get a PDF's Colorspace by PDFBox2.0.3.
> But it throws this exception.
> java.util.EmptyStackException
>          at java.util.Stack.peek(Stack.java:102)
>          at 
> org.apache.pdfbox.contentstream.PDFStreamEngine.getGraphicsState(PDFStreamEngine.java:918)
>          at 
> org.apache.pdfbox.examples.util.PrintTextColors.getColors(PrintTextColors.java:118)
>          at 
> org.apache.pdfbox.examples.util.PrintTextColors.main(PrintTextColors.java:103)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to