What are you seeing is the impact of newly placed transparency into a
PDF that had not previously contained it, when consideration isn't
given for the blending colorspace of the final output document.
You have an RGB document that upon adding transparency is forced into
CMYK due to lack of explicit blending space. If you were to specify
RGB as your explicit blending space at the same time you added your
transparency, all would be well.
Leonard
On Feb 14, 2008, at 4:17 AM, [EMAIL PROTECTED] wrote:
Hi,
I noticed a strange behaviour in PDFStamper yesterday. Maybe I am
doing something wrong...
The color of text (and images, and other objects, note the faded
red color of the box in the example documents) in PDF changes when
replacing a push button with PNG Image. But this only happens if I
flatten the form. An unflattened form maintains the color in the
document.
Code snippet of code reproducing the problem:
// Get fields
AcroFields form = stamper.getAcroFields();
// Load PNG Image
Image image = Image.getInstance("image.png");
// Replace button with image
PushbuttonField bt = form.getNewPushbuttonFromField
("picture1");
bt.setLayout(PushbuttonField.LAYOUT_ICON_ONLY);
bt.setProportionalIcon(true);
bt.setImage(image);
form.replacePushbuttonField("picture1", bt.getField());
// Flatten (or not) and close.
stamper.setFormFlattening(flatten); // Should we
flatten form?
stamper.close();
out.close();
Please find the attached example template, image, complete example
code and resulting files.
I am using Adobe Acrobat Reader 8.0. If I view the file in e.g
Sun's PDFRenderer, the color is OK. Maybe the problem is in Adobe
Acrobat Reader? But it is interesting that the color of the
document is preserved if flattening is not done, but altered when
the form is flattened.
P.S I bought The Book yesterday. Great stuff!
Sincerely yours
Leo
<ColorProblem_unflattened.pdf><image.png><ColorProblem.java><ColorProb
lem_flattened.pdf><ColorProblem_template.pdf>
----------------------------------------------------------------------
---
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/