Java create link to page in PDF with PDFBox -
my program links position in pdf-file page in same file. can click on defined position in file you'll linked page.
i use pdrectangle define position. unfortunately rectangle visible in document. want create link without visible border.
my code:
pdactiongoto action = new pdactiongoto(); action.setdestination(destination); pdannotationlink annotationlink = new pdannotationlink(); annotationlink.setaction(action); pdrectangle position = new pdrectangle(); position.setlowerleftx(bookmarklinkpositionentry.getlowerleftx()); position.setlowerlefty(bookmarklinkpositionentry.getlowerlefty()); position.setupperrightx(bookmarklinkpositionentry.getupperrightx()); position.setupperrighty(bookmarklinkpositionentry.getupperrighty()); annotationlink.setrectangle(position); destinationpdf.getpage(0).getannotations().add(annotationlink); i tried use annotationlink.sethidden(true); , annotationlink.setnoview(true);. documentation says "set hidden flag." , "set noview flag." , don't know happened there.
how can change visibility of rectangle or remove border completely?
you'll need set border style:
pdborderstyledictionary borderuline = new pdborderstyledictionary(); borderuline.setstyle(pdborderstyledictionary.style_underline); borderuline.setwidth(0); annotationlink.setborderstyle(borderuline); more on topic in addannotations.java example in source code download.
Comments
Post a Comment