Hi, all.
I'm trying to build a JPanel subclass (named JPanelPDF) that includes a custom "printPDF" public method to write the JPanel to a PDF document ussing Graphics2D returned by "PdfContentByte.createGraphics(w, h, mapper)". The idea is to design any JPanelPDF subclass with a WYSIWYG GUI editor (such as JDeveloper, NetBeans, etc) and, directly do a "panelObject.printPDF(outputStream)" at runtime. The object runs ok but it must to be showed previously to be printed to the PDF (?). If i directly call the panel's printPDF method the output PDF document only contains the non-text objects but if i shows previously the panel in any container (such a JFrame or JDialog) and then call panel's printPDF method, the output PDF document is ok (with lovelly vectorial fonts :-) ).
I am ussing TrueType fonts (calling "DefaultFontMapper.insertDirectory(...)") and at design time, in JDeveloper, i can see the fonts correctly since i do a "Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(path))" to get the adecuate "java.awt.Font" objects.
Thanks in advance.



Avelino Herrera

Attachment: jpanel_not_previously_showed.pdf
Description: Adobe PDF document


Attachment: jpanel_previously_showed.pdf
Description: Adobe PDF document

Reply via email to