Pdf Bookmark with JasperReports calculates wrong position

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
43
Joined: May 6 2013 - 6:01am
Last seen: 2 months 3 weeks ago

1 Answer:

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

Regards,

Lucian

lucianc's picture
72350
Joined: Jul 17 2006 - 1:10am
Last seen: 4 hours 28 min 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 - 9 years 9 months ago
Feedback
randomness