Hmm, you're right there, but the javadoc says that the command is for DeviceGray.

I looked in the source code, you have to use the command you used for DeviceN, this one uses the correct command.

    /**
     * Set the color components of current non stroking colorspace.
     *
     * @param components The components to set for the current color.
* @throws IOException If there is an error while writing to the stream.
     */
    public void setNonStrokingColor(float[] components) throws IOException
    {
        for (int i = 0; i < components.length; i++)
        {
            appendRawCommands(components[i]);
            appendRawCommands(SPACE);
        }
if (currentNonStrokingColorSpace instanceof PDSeparation || currentNonStrokingColorSpace instanceof PDPattern
                || currentNonStrokingColorSpace instanceof PDDeviceN
                || currentNonStrokingColorSpace instanceof PDICCBased)
        {
            appendRawCommands(SET_NON_STROKING_COLOR_COMPLEX);
        }
        else
        {
            appendRawCommands(SET_NON_STROKING_COLOR_SIMPLE);
        }
    }


I'll think about whether to make a check for the current colorspace in the other setNonStrokingColor methods if needed.


Tilman

Am 02.04.2015 um 02:08 schrieb Floris:
I tried version pdfbox-app-1.8.10-20150401.225545-14 and the separation color space is created properly. The color setting operator is wrong though. I get:

stream
/Cs3 cs
1 g <--------------------- This should be a 'scn' according to the PDF specifications. g is used with DeviceGray only.
10 10 20 20 re
f
BT
10 10 Td
/DeviceGray cs
/F0 10 Tf
0.5 G
(Hello World!) Tj
ET

endstream

It also seems that in the separation channel 255 bit is mapped to 1 while in the DeviceN case the recipe is specified directly (in the range of [0,1]): to obtain the above code I used 'contentStream.setNonStrokingColor(255);'. Is this intentional?


On 1-4-2015 23:12, Tilman Hausherr wrote:
I just fixed a second bug, so you'll have to wait again.
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox/1.8.10-SNAPSHOT/

Your version should be one higher than 11.

I was able to create a PDF, it has a black rectangle and "llo" in black.

Tilman

Am 01.04.2015 um 21:39 schrieb Floris Necas:
Here is the code again. I converted everything to spaces. Let me know
whether it came through properly this time.



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





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

Reply via email to