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
Could you attach a JRXML and the resulting PDF file? That would be easier to follow..
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...