|
Hello,
I'm trying to define an URL action for a PDF
document but it doesn't seem to work.
Here are some code excerpts:
PdfWriter writer = (PdfWriter)gc.getWorkingObject(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(pageWidth, pageHeight); Graphics2D g2 = tp.createGraphics(width, height, defaultFontMapper); ...do graphics stuff on g2... cb.addTemplate(tp, 0, 0); g2.dispose();
The PDF is rendered correctly. However, these actions are also executed (after doing graphics stuff, on each page): Rectangle r = o.objectRect; cb.setAction( new PdfAction(linkURL), r.x, r.y ,r.x + r.width, r.y + r.height);cb.circle(r.x, r.y, r.width); This should generate links for some objects, but it does nothing. Also, the 'circle' line does not output a circle as expected. I removed almost all the graphic painting code but the circle or any other object created through PDFContentByte does not display. It seems strange however that the linkUrl text appears in the PDF file source. The link code worked when everything was painted using only contentByte. If you have any ideas please give me a hint. I am suspecting that you cannot modify both PDFContentByte and its Graphics at the same time, but probably I'm wrong.
With thanks, Ligius |
- RE: [iText-questions] PdfGraphics2D and PDFContentByte p... Ligius Astratinei
- RE: [iText-questions] PdfGraphics2D and PDFContentB... Paulo Soares
- Fw: [iText-questions] PdfGraphics2D and PDFContentB... Ligius Astratinei
- RE: [iText-questions] PdfGraphics2D and PDFContentB... Paulo Soares
