You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Marek Zajac (JIRA)" <ji...@apache.org> on 2017/06/12 15:32:00 UTC

[jira] [Commented] (PDFBOX-3687) PDFBox doesn't respect different setting of /DA at PDAnnotationWidget level to /DA at PDField level

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

Marek Zajac commented on PDFBOX-3687:
-------------------------------------

Hi [~msahyoun], 
 I ve got two questions regarding this issue. What is the difference between using the 
{code:title=PDFCreator.java|borderStyle=solid}
COSDictionary dict = field.getCOSObject();
dict.setString(COSName.DA, "/Helv 0 Tf 0 0 0.5 rg");		
{code}
or 
{code:title=PDFCreator.java|borderStyle=solid}
PDTextField field = (PDTextField)form.getField("Text1");
field.setDefaultAppearance("/Helv 0 Tf 1 0 0 rg");
{code}

I am trying to override the default appearance on the field level and both ways work for me. However both fail when the PDTextField field has more occurrences in the same pdf file like Text1#0, Text1#1 and Text1#2. In this case the new appearance is used only in the first copy of the field - Text1#0. Is there any way to get all copies of my Text1 field to use the new appearance settings ? I am using version 2.0.6.
Marek 



> PDFBox doesn't respect different setting of /DA at PDAnnotationWidget level to /DA at PDField level
> ---------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-3687
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3687
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.4
>            Reporter: Scott Coldwell
>            Assignee: Maruan Sahyoun
>             Fix For: 2.0.6, 3.0.0
>
>         Attachments: DifferentDALevels.pdf, SF1152.pdf, TestSF1152-LL.pdf
>
>
> See the attached file "SF1152.pdf" and locate the "Bureau" field.  If you open this document in Acrobat the font size shows as Auto and functions as such in Acrobat/Acrobat Reader.  However, PDFBox thinks the font size is set to 9.  I confirmed this in both PDFDebugger and in our rendering code.
> The second attachment "TestSF1152-LL.pdf" shows the behavior from PDFBox not picking up the correct Auto font size.  The value is truncated unless you click inside the field or delete the value and replace it.
> The following code shows the problem:
> {code}
>             final PDDocument document = PDDocument.load(ClassLoader.getSystemResourceAsStream("SF1152.pdf"));
>             final PDAcroForm form = document.getDocumentCatalog().getAcroForm();
>             final PDTextField field = (PDTextField)form.getField("Bureau");
>             final COSDictionary dict = field.getCOSObject();
>             String defaultAppearance = ((COSString)dict.getDictionaryObject(COSName.DA)).getString();
>             System.out.println(defaultAppearance);
> {code}
> results in:
> {code}
> /Helv 9 Tf 0 0 0.5 rg
> {code}
> If I manually set the font size to auto using:
> {code}
> dict.setString(COSName.DA, "/Helv 0 Tf 0 0 0.5 rg");
> {code}
> the PDF renders correctly.
> But we shouldn't have to manipulate font sizes in code when it's set correctly in the PDF.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org