[
https://issues.apache.org/jira/browse/PDFBOX-2830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14584569#comment-14584569
]
Tilman Hausherr commented on PDFBOX-2830:
-----------------------------------------
I also looked at version 1654337, which is the one before the "gamma" change.
There are only two uses of PDDcolor.toCOSArray():
- PDOutlineItem: for /C, it doesn't require the extra aray element
- PDBoxStyle: for /C, it doesn't require the extra array element
I also found out when the extra element is used: it is used to specify the
color of an uncoloured tiling pattern in content streams, like this: {{0.30
0.75 0.21 /P2 scn}}. However this is only relevant for the constructor. All the
uses mentioned earlier allow only the Gray, RGB and CMYK. The extra array
element is not used in PDPageContentStream.setStrokingColor(), or in
setNonStrokingColor(), intead the color components are used with
color.getComponents() and then the pattern (if needed) is used with
color.getPatternName().
Thus I'm removing "array.add(patternName);" from toCOSArray().
> Can't draw color border around a PDTextBox + create example
> -----------------------------------------------------------
>
> Key: PDFBOX-2830
> URL: https://issues.apache.org/jira/browse/PDFBOX-2830
> Project: PDFBox
> Issue Type: Bug
> Components: AcroForm, PDModel
> Affects Versions: 2.0.0
> Reporter: Tilman Hausherr
> Labels: regression
>
> There's a thread "Setting a border color on a PDTextBox" in the user mailing
> list. This relates to version 1.8.*, but I wanted to create an example for
> 2.0. After doing this for 2.0 with this code
> {code}
> PDAppearanceCharacteristicsDictionary fieldAppearance =
> new PDAppearanceCharacteristicsDictionary(new
> COSDictionary());
> PDColor green = new PDColor(new float[] { 0, 1, 0 },
> PDDeviceRGB.INSTANCE);
> fieldAppearance.setBorderColour(green);
> widget.setAppearanceCharacteristics(fieldAppearance);
> {code}
> it didn't work. The reason is this in the PDF:
> {code}
> 5 0 obj
> <<
> /FT /Tx
> /T (SampleField)
> /Type /Annot
> /Subtype /Widget
> /Rect [50.0 750.0 250.0 800.0]
> /MK 7 0 R
> /V (English form contents)
> /AP 8 0 R
> >>
> endobj
> 6 0 obj
> <<
> /Font 9 0 R
> >>
> endobj
> 7 0 obj
> <<
> /BC [0.0 1.0 0.0 null] <===================
> >>
> endobj
> {code}
> The /BC color array has an extra null element which comes from a
> "patternName" in PDColor:
> {code}
> public COSArray toCOSArray()
> {
> COSArray array = new COSArray();
> array.setFloatArray(components);
> array.add(patternName);
> return array;
> }
> {code}
> Removing it in the PDF brings a "good" file. I believe this is a regression
> that came from changing PDGamma to PDColor some time ago in PDFBOX-2629.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]