You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2018/12/18 11:26:00 UTC
[jira] [Comment Edited] (PDFBOX-4410) Not getting location of
Form-Field correct when page has landscape orientation
[ https://issues.apache.org/jira/browse/PDFBOX-4410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16723966#comment-16723966 ]
Tilman Hausherr edited comment on PDFBOX-4410 at 12/18/18 11:25 AM:
--------------------------------------------------------------------
Shouldn't this be
{code:java}
PDRectangle rectangle = widget.getRectangle();
FieldRect = new RectangleF(
rectangle.getLowerLeftX(),
rectangle.getLowerLeftY(), /// <==== corrected
rectangle.getWidth(),
rectangle.getHeight());
{code}
?
Anyway, your code contains syntax errors or typoes or externall classes, so I changed it like this
{code}
System.out.println(doc.getPages().indexOf(annPage) + " " + ann.getRectangle());
PDRectangle rectangle = ann.getRectangle();
java.awt.Rectangle fieldRect = new java.awt.Rectangle(
(int) rectangle.getLowerLeftX(),
(int) rectangle.getLowerLeftY(),
(int) rectangle.getWidth(),
(int) rectangle.getHeight());
System.out.println(fieldRect);
{code}
and I get this:
{noformat}
10 [64.6651,467.137,73.5991,595.897]
java.awt.Rectangle[x=64,y=467,width=8,height=128]
10 [64.3951,615.342,73.3291,744.102]
java.awt.Rectangle[x=64,y=615,width=8,height=128]
10 [76.6501,467.137,85.5851,595.897]
java.awt.Rectangle[x=76,y=467,width=8,height=128]
10 [76.3801,615.342,85.3151,744.102]
java.awt.Rectangle[x=76,y=615,width=8,height=128]
10 [88.6361,467.137,97.5701,595.897]
java.awt.Rectangle[x=88,y=467,width=8,height=128]
{noformat}
which looks ok to me.
was (Author: tilman):
Shouldn't this be
{code:java}
PDRectangle rectangle = widget.getRectangle();
FieldRect = new RectangleF(
rectangle.getLowerLeftX(),
rectangle.getLowerLeftY(),
rectangle.getWidth(),
rectangle.getHeight());
{code}
?
Anyway, your code contains syntax errors or typoes or externall classes, so I changed it like this
{code}
System.out.println(doc.getPages().indexOf(annPage) + " " + ann.getRectangle());
PDRectangle rectangle = ann.getRectangle();
java.awt.Rectangle fieldRect = new java.awt.Rectangle(
(int) rectangle.getLowerLeftX(),
(int) rectangle.getLowerLeftY(),
(int) rectangle.getWidth(),
(int) rectangle.getHeight());
System.out.println(fieldRect);
{code}
and I get this:
{noformat}
10 [64.6651,467.137,73.5991,595.897]
java.awt.Rectangle[x=64,y=467,width=8,height=128]
10 [64.3951,615.342,73.3291,744.102]
java.awt.Rectangle[x=64,y=615,width=8,height=128]
10 [76.6501,467.137,85.5851,595.897]
java.awt.Rectangle[x=76,y=467,width=8,height=128]
10 [76.3801,615.342,85.3151,744.102]
java.awt.Rectangle[x=76,y=615,width=8,height=128]
10 [88.6361,467.137,97.5701,595.897]
java.awt.Rectangle[x=88,y=467,width=8,height=128]
{noformat}
which looks ok to me.
> Not getting location of Form-Field correct when page has landscape orientation
> ------------------------------------------------------------------------------
>
> Key: PDFBOX-4410
> URL: https://issues.apache.org/jira/browse/PDFBOX-4410
> Project: PDFBox
> Issue Type: Bug
> Components: AcroForm
> Affects Versions: 2.0.12
> Reporter: Amit Maheshwari
> Priority: Critical
> Attachments: RPA_WTA_Extended (1).pdf
>
>
> In my client application, I need to know the location of form fields.
> *For getting the location, I am relaying on those widgets of field which has non-negative page number.*
>
> In attached Pdf File ( [^RPA_WTA_Extended (1).pdf] ). when it changes orientation (page - 10), I could see widgets with non-negative page number was giving me improper location.
>
> For getting page I'm doing this:
> {code:java}
> int getPageOfWidget(PDAnnotationWidget widget, PDPageTree pages)
> {
> return pages.indexOf(widget.getPage());
> }
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org