Home
Analytics
setting PDF TOC/bookmark dynamically
rpfong
G'day. I'm experiencing a design/render problem with PDF TOC/bookmarks. We have an onCreate JavaScript function attached to an ILabelInstance that sets its text at render-time. I would also like to change the bookmark text but that's in the IReportItem interface.
Is there a way to get an ILabel/IReportItem pointer from an ILabelInstance during the onCreate function at render-time? Thanks.
Find more posts tagged with
Comments
CBR
if you have a point to the label you should be able to call createAction() on that label.
action = myLabel.createAction();
action.setBookmark("myBookmarkText");
myLabel.setAction(action); // think that line isn't necessary
rpfong
Hm, that didn't work. I noticed that PDF bookmarks actually correspond to the 'toc' or 'Table of Contents' property and not the 'bookmark' property as Birt uses.
I have a workaround that involves taking the onCreate script that replaces the curly brace contents, pasting into the TOC property and removing the lvalue from the last line so that instead of having the label receive the value via 'this.text =', it gets returned from the expression and used as the PDF bookmark.
It's a lot of code duplication but works.