Hi,
Im new to iText.
I need to convert Some Simple HTML To PDF and i also need to add some
image's to pdf too.
I've some problems while converting HTML to PDF. In my pdf output,the font
is not correct which i orginally gave in HTML content(Comic Sans MS). 
I've used JLabel to convert JLabel graphics(HTML) to PDFGraphics.

This is my sample HTML Content ::

<html><head></head><body><p style="margin-top: 0">< font face="Comic Sans
MS" color="#ff0000" size="2">Test Message Test Message1 Test
Message2</p></body></html>

My Code::

JFrame textFrame = new JFrame();
textFrame.setMinimumSize(new Dimension(500,500));
JLabel txtLbl = new JLabel("<html><head></head><body><p style=\"margin-top:
0\">< font face=\"Comic Sans MS\" color=\"#ff0000\" size=\"2\">Test Message
Test Message1 Test Message2</p></body></html>");
txtLbl.setBounds(0,0,500,75);
textFrame.add(txtLbl);
PdfTemplate pdfTemplate = contentByte.createTemplate(500,70);
Graphics2D graphics = pdfTemplate.createGraphics(500,70);
txtLbl.print(graphics);
graphics.dispose();
contentByte.addTemplate(pdfTemplate,0,0);
textFrame.setVisible(true);
document.close();


Any Suggestion or Any other ways to convert HTML to pdf..??
Thanks in advance.
Regards,
Aashik.
-- 
View this message in context: 
http://www.nabble.com/How-to-set-Font-in-PDF-Graphics2D-tp24787975p24787975.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to