Pdf Bookmark with JasperReports calculates wrong position

0

I like to use bookmarking in pdf creation out of JasperReports.

Therefore I use the anchorNameExpression-tag and the bookmarkLevel-attribute on textField elements. They automatically produce bookmark in pdf when the jasperPrint is exported as pdf.

But the position of the bookmarks are calculated with the wrong position. They use relative position of the text elements instead of absolute position on a page.

What I do is the following:

I got a jrxml which contains the following elements

  • textField1 (position x=10, y=10)
  • a frame2 (position x= 50, y=50), which contains itself a textField2 (position x=5, y=5)

I have designed the following anchors in jrxml:

  • textField1: anchorName="bookmark1", bookmarkLevel=1
  • textField2: anchorName="bookmark2", bookmarkLevel=1

What happens is that the bookmarks in pdf will have the following positions:

  • bookmark1: position x=10, y=10
  • bookmark2: position x=5, y=5

-> the bookmark should have the absolut position, calculated with its surrounding container:

  • bookmark2: position x=55 ( sum of the x-position of the frame and the x-position of the textField2). Same for y-position
Neobye's picture
15
Joined: May 6 2013 - 6:01am
Last seen: 1 day 17 hours ago

1 Answer:

0

Could you attach a JRXML and the resulting PDF file?  That would be easier to follow..

Regards,

Lucian

lucianc's picture
7075
Joined: Jul 17 2006 - 1:10am
Last seen: 1 week 3 days ago

Hy Lucian, I just uploaded a test jrxml and the corresponding pdf output.
I guess I found the solution (I also created a bug report and will document there the problem and the solution
-> see http://community.jaspersoft.com/jasperreports-library/issues/3004-0#comm...

Neobye - 6 years 2 months ago
Feedback