pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Grosso <gary.gro...@oberontech.com>
Subject RE: what should PDAppearanceCharacteristicsDictionary.setRolloverCaption do?
Date Thu, 25 May 2017 17:29:03 GMT
I see.

Does PDFBox provide a way to set the TU (alternate field name) field?

Thanks,
Gary

-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Thursday, May 25, 2017 11:57 AM
To: users@pdfbox.apache.org
Subject: Re: what should PDAppearanceCharacteristicsDictionary.setRolloverCaption do?

I looked at the files in PDFDebugger. The "This is a tooltip added by acrobat" line appears
in "/TU", which is meant for something different:

(Optional; PDF 1.3) An alternate field name that shall be used in place of the actual field
name wherever the field shall be identified in the user interface (such as in error or status
messages referring to the field). This text is also useful when extracting the document’s
contents in support of accessibility to users with disabilities or for other purposes (see
14.9.3, “Alternate Descriptions”).

Tilman

Am 25.05.2017 um 15:23 schrieb Gary Grosso:
> One more upload: 
> http://aapro.net/PDF/DocBookTest3_modified_w-Acrobat-Tooltip-also-Text
> Field.pdf
>
> Contrary to what I inferred from "how to add tooltip" articles I read online, Acrobat
allows me to add a tooltip to a textfield (not just a button), and it works just fine.
>
> This is so much nicer than foodling around with invisible buttons. It would be great
if this just worked in PDFBox.
>
> Gary
>
>
> -----Original Message-----
> From: Gary Grosso [mailto:gary.grosso@oberontech.com]
> Sent: Thursday, May 25, 2017 9:04 AM
> To: users@pdfbox.apache.org
> Subject: RE: what should PDAppearanceCharacteristicsDictionary.setRolloverCaption do?
>
> I also uploaded 
> http://aapro.net/PDF/DocBookTest3_modified_captionsByPDFBox.pdf
>
> -----Original Message-----
> From: Gary Grosso [mailto:gary.grosso@oberontech.com]
> Sent: Thursday, May 25, 2017 8:54 AM
> To: users@pdfbox.apache.org
> Subject: RE: what should PDAppearanceCharacteristicsDictionary.setRolloverCaption do?
>
> Yes, it does work if done with Acrobat, see http://aapro.net/PDF/DocBookTest3_modified_w-Acrobat-Tooltip.pdf
( done using Button Properties > General > Tooltip).
>
> I need general tooltip capability. Everywhere I look, this is done with buttons, sometimes
invisible. This is perhaps the last requirement needed for a customer to choose PDFBox (and
my services) for this work.
>
> Can this be made to work, or can another way be described of getting tooltips (to appear
on various form fields)?
>
> One possibility seems to be using NormalCaption on an invisible button. I am able to
make the button invisible, but not the caption text. Also, if I succeed in making the caption
text invisible, I don't know if it will stay invisible when moused over.
>
> Thanks,
> Gary
>
>
>
> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de]
> Sent: Thursday, May 25, 2017 4:21 AM
> To: users@pdfbox.apache.org
> Subject: Re: what should PDAppearanceCharacteristicsDictionary.setRolloverCaption do?
>
> According to the PDF spec: "(Optional; pushbutton fields only) The widget annotation's
rollover caption, which shall be displayed when the user rolls the cursor into its active
area without pressing the mouse button."
>
> The best would be to create such a file with Adobe Acrobat to see if it works at all.
>
> Tilman
>
>
> Am 25.05.2017 um 03:45 schrieb Gary Grosso:
>> I was expecting PDAppearanceCharacteristicsDictionary.setRolloverCaption(String<eclipse-javadoc:%E2%98%82=Morph2Form/D:%5C/JavaTraining%5C/EclipseNeonWorkspace%5C/CreateSimpleForm%5C/lib%5C/pdfbox-2.0.6.jar%3Corg.apache.pdfbox.pdmodel.interactive.annotation(PDAppearanceCharacteristicsDictionary.class%E2%98%83PDAppearanceCharacteristicsDictionary~setRolloverCaption~Ljava.lang.String;%E2%98%82java.lang.String>
caption) to display the value of argument caption when the user's mouse rolled over the widget.
>>
>> I get the value passed to setNormalCaption() regardless. Is the problem with my expectations,
my usage, or the implementation?
>>
>> I'm morphing an existing PDF document, finding locations based on a kludge, since
this is still proof-of-principle, so I only show the one method below. I can write a create-PDF-from-scratch
driver for the method if necessary.
>>
>> Thanks,
>> Gary
>>
>>       private static void addButtonAtRect(PDPage page, PDAcroForm acroForm, String
text, PDRectangle rect) {
>>           PDPushButton pushButton = new PDPushButton(acroForm);
>>
>>           // For now, just make sure each partial name is unique.
>>           String nameStr = text.replaceAll(" ", "") + "Name" + Integer.toString(nameCnt);
>>           nameCnt++;
>>           pushButton.setPartialName(nameStr);
>>
>>           acroForm.getFields().add(pushButton);
>>
>>           PDAnnotationWidget widget = pushButton.getWidgets().get(0);
>>           widget.setRectangle(rect);
>>           if (rect.getHeight() < MIN_RECT_HEIGHT) {
>>               float diff = MIN_RECT_HEIGHT - rect.getHeight();
>>               rect.setLowerLeftY((float) (rect.getLowerLeftY() - diff/2.0));
>>               rect.setUpperRightY((float) (rect.getUpperRightY() + diff/2.0));
>>           }
>>
>>           widget.setPage(page);
>>
>>           String jsString = "app.alert(\"" + text + " 
>> Performed.\");";
>>
>>           //Creating PDActionJavaScript object
>>           PDActionJavaScript action = new PDActionJavaScript(jsString);
>>           widget.setAction(action);
>>
>>           acroForm.setNeedAppearances(true);
>>
>>           PDAppearanceCharacteristicsDictionary fieldAppearance = new PDAppearanceCharacteristicsDictionary(new
COSDictionary());
>>           fieldAppearance.setBorderColour(new PDColor(new float[]{0.3F, 0.3F, 0.7F},
PDDeviceRGB.INSTANCE));
>>           fieldAppearance.setBackground(new PDColor(new float[]{0.9F, 0.9F, 0.9F},
PDDeviceRGB.INSTANCE));
>>           fieldAppearance.setNormalCaption("This is my NormalCaption");
>>           fieldAppearance.setRolloverCaption("This is my RolloverCaption");
>>           fieldAppearance.setAlternateCaption("This is my AlternateCaption");
>>           widget.setAppearanceCharacteristics(fieldAppearance);
>>
>>           widget.setPrinted(true);
>>
>>           try {
>>               page.getAnnotations().add(widget);
>>           } catch (IOException e) {
>>               e.printStackTrace();
>>           }
>>       }
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


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

Mime
View raw message