Hi,
Am 11.09.2013 20:03, schrieb Buzzy Spain:
The colorspace seems to be set to DeviceRGB everywhere that I can find.
Anyone have tips for controlling the final colors more consistently?
Are you sure that the pdf is the problem?
The only thing I have found is PDF's support for embedding a transfer
function in the PDF (Does PDFBox support this?). If I am understanding
this correctly, embedding a transfer function would tailor the PDF to some
specific output device (ie, a particular monitor). I don't have that kind
of control over the viewing/printing environment for the PDFs being
generated so that probably won't work for me.
What exactly do you mean? It is possible to define special colors as
replacement for RGB or CMYK color values, but AFAIK those are used when
printing the pdf.
Thanks in advance for any help on this.
Buzzy
On Tue, Sep 10, 2013 at 3:27 PM, Buzzy Spain <[email protected]> wrote:
Thanks, Lachezar. I think something else is going on; the images may be
just the most obvious issue. My black (Color.BLACK) text is picking as RGB
5,6,7 rather than 0,0,0. A filled rectangle is also showing a color shift.
barColor=new Color(179,26,51); // <--- renders as 181,52,58
contentStream.setNonStrokingColor(barColor);
contentStream.fillRect( graphLeft, tableRowY, graphSize * barPercent,
Table.BAR_HEIGHT);
Did you ever check the color values within the pdf itself using the PDFDebugger?
On Tue, Sep 10, 2013 at 2:25 PM, Lachezar Dobrev <[email protected]>wrote:
Possibly the images get compressed as JPEG or similar.
I've had problems with other PDF generators too, occasionally when
adding a Bar Code to the PDF it gets severely distorted. As it turns
out the encoder compressed the image using JPEG, which results in
severe errors in the image.
2013/9/10 Buzzy Spain <[email protected]>:
Hi all,
I am trying to understand why the images I am writing into a pdf end up
with different rgb values than the input images.
How about extracting the resulting image from the pdf to compare it to the input
image using the very same image viewer? Just to see if the color shift is a
result of the jpeg compression algo.
As an example, for one image, if I open the png file in MS Paint and
use
the color picker I get RGB of (179,26,51). After writing that same
image
to a page's content stream, saving the document, and then opening it in
Adobe Acrobat, if I use a color picker tool the RGB value is (181, 52,
58).
Other images have significant shifts in other channels.
Can anyone provide any tips on how to address this?
Thanks,
Buzzy
ps. Code for adding images to document is below:
BufferedImage image = ImageIO.read(new File("colorLegend.png"));
PDJpeg xImage = new PDJpeg(document, image, quality);
//PDPixelMap xImage = new PDPixelMap(document, image); // <--- doesn't
seem to help
contentStream.drawXObject(xImage, x, y, width, height);
Can you provide us with a sample pdf?
BR
Andreas Lehmkühler