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

Tilman Hausherr edited comment on PDFBOX-3598 at 11/29/16 7:17 AM:
-------------------------------------------------------------------

You got DeviceGray either because this is the default colorspace for stroking 
and non-stroking, or because it is set in the content stream (I saw "0.0039 g" 
- you can see that with the PDFDebugger command line application). What you saw 
with Notepad++ is the colorspace of an image.

Stroking is lines, curves etc. Non stroking is filling stuff. (Both also apply 
to text; usually it's the non stroking color) Images have their own colorspace; 
in your file, the colorspaces that are set are irrelevant.

This is your content stream of the first page. Open the PDF 32000 specification 
and search "operator summary" to see what the operators (q, cm, rg, g, Do), 
mean.
{code}
q
  1.0 0 0 1.0 0.0 0.09 cm
  q
    595.2 0 0 841.8 0.0 0.0 cm
    /Im23 Do
  Q
  q
    0.0039 g
    437.64 0 0 391.08 69.12 120.48 cm
    /Im24 Do
  Q
  q
    0.0039 g
    245.04 0 0 15.84 63.36 750.12 cm
    /Im25 Do
  Q
  q
    0.0039 g
    486.0 0 0 11.04 53.76 13.8 cm
    /Im26 Do
  Q
  q
    0.0039 g
    321.0 0 0 82.44 87.36 531.84 cm
    /Im27 Do
  Q
  q
    0.0039 g
    422.4 0 0 11.64 54.72 815.76 cm
    /Im28 Do
  Q
  q
    0.0039 g
    317.28 0 0 50.28 158.4 654.24 cm
    /Im29 Do
  Q
  q
    0.4235 0.4078 0.3961 rg
    99.72 0 0 9.84 427.2 59.16 cm
    /Im30 Do
  Q
  q
    0.4235 0.4078 0.3961 rg
    99.72 0 0 9.96 427.2 712.8 cm
    /Im31 Do
  Q
  q
    0.0 0.4 0.7922 rg
    80.64 0 0 7.8 63.36 732.24 cm
    /Im32 Do
  Q
  q
    0.0039 g
    176.28 0 0 12.36 69.12 627.84 cm
    /Im33 Do
  Q
  q
    0.4235 0.4078 0.3961 rg
    64.32 0 0 10.44 67.2 712.32 cm
    /Im34 Do
  Q
  q
    0.0039 g
    31.92 0 0 48.96 111.36 655.56 cm
    /Im35 Do
  Q
  q
    0.0039 g
    176.88 0 0 12.96 69.12 77.16 cm
    /Im36 Do
  Q
  q
    0.0039 g
    50.4 0 0 10.56 489.6 817.8 cm
    /Im37 Do
  Q
  q
    0.0039 g
    28.8 0 0 48.24 491.52 283.8 cm
    /Im38 Do
  Q
  q
    0.4235 0.4078 0.3961 rg
    19.44 0 0 10.32 67.2 58.68 cm
    /Im39 Do
  Q
  q
    0.0039 g
    30.12 0 0 22.8 491.52 232.44 cm
    /Im40 Do
  Q
  q
    0.0039 g
    16.92 0 0 4.92 125.76 697.68 cm
    /Im41 Do
  Q
  q
    0.0039 g
    15.24 0 0 14.52 491.52 188.88 cm
    /Im42 Do
  Q
Q
{code}

I'm closing this as not a problem because whatever the original problem was, it 
has already been solved. You're lucky, the 2.0.4 version is planned to come out 
next week.

Btw, if you ask questions to the user mailing list, you must upload PDF files 
or screenshots somewhere, e.g. dropbox, google drive or a sharehoster, because 
attachments don't get through.


was (Author: tilman):
You got DeviceGray either because this is the default colorspace for stroking 
and non-stroking, or because it is set in the content stream (I saw "0.0039 g" 
- you can see that with the PDFDebugger command line application). What you saw 
with Notepad++ is the colorspace of an image.

Stroking is lines, curves etc. Non stroking is filling stuff. (Both also apply 
to text; usually it's the non stroking color) Images have their own colorspace; 
in your file, the colorspaces that are set are irrelevant.

This is your content stream of the first page. Open the PDF 32000 specification 
and search "operator summary" to see what they mean.
{code}
q
  1.0 0 0 1.0 0.0 0.09 cm
  q
    595.2 0 0 841.8 0.0 0.0 cm
    /Im23 Do
  Q
  q
    0.0039 g
    437.64 0 0 391.08 69.12 120.48 cm
    /Im24 Do
  Q
  q
    0.0039 g
    245.04 0 0 15.84 63.36 750.12 cm
    /Im25 Do
  Q
  q
    0.0039 g
    486.0 0 0 11.04 53.76 13.8 cm
    /Im26 Do
  Q
  q
    0.0039 g
    321.0 0 0 82.44 87.36 531.84 cm
    /Im27 Do
  Q
  q
    0.0039 g
    422.4 0 0 11.64 54.72 815.76 cm
    /Im28 Do
  Q
  q
    0.0039 g
    317.28 0 0 50.28 158.4 654.24 cm
    /Im29 Do
  Q
  q
    0.4235 0.4078 0.3961 rg
    99.72 0 0 9.84 427.2 59.16 cm
    /Im30 Do
  Q
  q
    0.4235 0.4078 0.3961 rg
    99.72 0 0 9.96 427.2 712.8 cm
    /Im31 Do
  Q
  q
    0.0 0.4 0.7922 rg
    80.64 0 0 7.8 63.36 732.24 cm
    /Im32 Do
  Q
  q
    0.0039 g
    176.28 0 0 12.36 69.12 627.84 cm
    /Im33 Do
  Q
  q
    0.4235 0.4078 0.3961 rg
    64.32 0 0 10.44 67.2 712.32 cm
    /Im34 Do
  Q
  q
    0.0039 g
    31.92 0 0 48.96 111.36 655.56 cm
    /Im35 Do
  Q
  q
    0.0039 g
    176.88 0 0 12.96 69.12 77.16 cm
    /Im36 Do
  Q
  q
    0.0039 g
    50.4 0 0 10.56 489.6 817.8 cm
    /Im37 Do
  Q
  q
    0.0039 g
    28.8 0 0 48.24 491.52 283.8 cm
    /Im38 Do
  Q
  q
    0.4235 0.4078 0.3961 rg
    19.44 0 0 10.32 67.2 58.68 cm
    /Im39 Do
  Q
  q
    0.0039 g
    30.12 0 0 22.8 491.52 232.44 cm
    /Im40 Do
  Q
  q
    0.0039 g
    16.92 0 0 4.92 125.76 697.68 cm
    /Im41 Do
  Q
  q
    0.0039 g
    15.24 0 0 14.52 491.52 188.88 cm
    /Im42 Do
  Q
Q
{code}

I'm closing this as not a problem because whatever the original problem was, it 
has already been solved. You're lucky, the 2.0.4 version is planned to come out 
next week.

Btw, if you ask questions to the user mailing list, you must upload PDF files 
or screenshots somewhere, e.g. dropbox, google drive or a sharehoster, because 
attachments don't get through.

> 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