Jump to content
JasperReports Library 7.0 is now available ×

Pdf Bookmark with JasperReports calculates wrong position

Go to solution Solved by lucianc,

Recommended Posts

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
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...