On the widget, call getPage() this will return a PDPage object or null
(bad programming). with the PDPage, do this:
doc.getPages().indexOf(pdPage)
that will get you the zero-based index of the given page, or -1 if the
page is not found.
Tilman
PS the debugger has a second view ("show internal structure")
Am 27.04.2018 um 15:42 schrieb JZ Q:
Hi Tilman,
How do I know on which page the PDField is located? The Rubber Stamp is
appended based on PDRectangle, which is the position on a single page. So
in a multiple-page PDF, how do I know the page number from the field itself
or its related objects?
I used debugger, but was not able to find any useful info. Thanks.
Jason
On Fri, Apr 27, 2018 at 9:15 AM, Tilman Hausherr <[email protected]>
wrote:
If you mean an acroform field, then do this:
doc.getDocumentCatalog().getAcroForm().getField("name").
getWidgets(0).getRect()
show all fields with
acroform.getFieldIterator()
Note that not everything that looks like a field is a field. If it isn't
an acroform field then open the file with PDFDebugger and move the mouse
and you'll see the coordinate.
And even if it is a field, putting an image at the field position will not
disable the field.
Tilman
Am 27.04.2018 um 15:00 schrieb JZ Q:
Dear Tilman,
I studied "RubberStampWithImage" class in code examples and was able to
get
some clue about how to do it. I have another question: if I want to put
the
rubber stamp at field "A", how do I figure out on which is this field
located and the (x,y) coordinate of that field on that page? Thanks.
Jason
On Fri, Apr 27, 2018 at 3:26 AM, Tilman Hausherr <[email protected]>
wrote:
Hi,
Sounds like you just used the code and didn't use
PDAnnotationRubberstamp.
What I meant was that you start with PDAnnotationRubberstamp, set the
rectangle, and then create the appearance stream just like it is done in
CreateVisibleSignature2.createVisualSignatureTemplate(). Just substitute
"widget" with your rubberstampannotation variable and ignore the
signature
related stuff.
Tilman
Am 27.04.2018 um 01:54 schrieb JZ Q:
Hi Tilman,
Thank you for info in your previous reply. I tried the code
CreateVisibleSignature2
and it works, but I simply want to attach an image of signature at
appropriate places in PDF. The agent will print the document with his
signature and pass it to client for manual signing.
How to use the PDAnnotationWidget or rubberstamp annotation? Is there
anything I can read to get a better understanding. Thanks.
Jason
On Tue, Apr 24, 2018 at 3:08 PM, Tilman Hausherr <[email protected]
wrote:
Assuming you don't mean an electronic signature, the best would be a
rubberstamp annotation. To include the image you'd need to create an
appearance stream, which is quite tricky. See
CreateVisibleSignature2.createVisualSignatureTemplate
in the source code download. Although that one is about signature
fields,
you should start from widget which has the type PDAnnotationWidget, but
do
everything that is done for "widget" for your rubberstamp annotation.
Try to get this working, don't try too long / too hard, post the code
that
you did here to get more help.
See AddAnnotations in the source code for a general example how to add
annotations.
Tilman
Am 24.04.2018 um 15:14 schrieb JZ Q:
Hi everyone,
I need to attach image (not text) of initials and signature to certain
field or position in the pdf file. Do you know how to do it?
Take the following document as example, at the bottom of the form,
there
are places the users can put initial and signatures. How to add images
(jpg, gif) of the signature to the right form field? Thanks.
https://drive.google.com/file/d/18k-MaJR2QLsVcjgf95y3gtu5By0
HJs1X/view?usp=sharing
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]