xmlworker

iTextSharp HTMLWorker.ParseToList() throws NullReferenceException

こ雲淡風輕ζ 提交于 2019-11-28 03:18:47
问题 I am using iTextSharp v.4 to merge a whole bunch of html files. It was working fine until I needed to upgrade to v.5 of iTextSharp. The problem comes when I pass a streamreader (reading the content of the html file) into the HTMLWorker object's ParseToList method. It throws a null reference exception. On debugging it I can access the streamReader and can confirm that the correct content of the file is read. Here is the code: List<IElement> objects; try { objects = HTMLWorker.ParseToList(new

RTL not working in pdf generation with itext 5.5 for Arabic text

两盒软妹~` 提交于 2019-11-27 16:19:25
I have java code that writes arabic characters with the help of itext 5.5 and xmlworker jars, but its writing left to right even after writer.setRunDirection(PdfWriter.RUN_DIRECTION_RTL) is used. Code used is: public class CreateArabic extends DefaultHandler { /** Paths to and encodings of fonts we're going to use in this example */ public static String[][] FONTS = { {"C:/arialuni.ttf", BaseFont.IDENTITY_H}, {"C:/abserif4_5.ttf", BaseFont.IDENTITY_H}, {"C:/damase.ttf", BaseFont.IDENTITY_H}, {"C:/fsex2p00_public.ttf", BaseFont.IDENTITY_H} }; /** Holds he fonts that can be used for the peace

ItextSharp Error on trying to parse html for pdf conversion

无人久伴 提交于 2019-11-27 13:44:02
I was using the ItextSharp module to convert the below listed html in to a pdf page. <div style="font-size: 18pt; font-weight: bold;"> mma<br>mmar</div><br> <br> <div style="font-size: 14pt;">Click to View Pricing </div> <br> <div> <table> <tr><td> <a href="http://www.mma.com/fci" style="color: Blue; font-size: 10pt; text-decoration: underline;"> FCI</a>:</td> <td><a href="http://www.mma.com/access/?pn=78211-014" style="color: Blue; font-size: 10pt; text-decoration: underline;"> 78211-014</a></td></tr><tr><td></td> <td> <a href="http://www.mma.com/access/?pn=78211-009" style="color: Blue; font

How to convert HTML to PDF using iTextSharp

淺唱寂寞╮ 提交于 2019-11-25 23:03:39
问题 I want to convert the below HTML to PDF using iTextSharp but don\'t know where to start: <style> .headline{font-size:200%} </style> <p> This <em>is </em> <span class=\"headline\" style=\"text-decoration: underline;\">some</span> <strong>sample<em> text</em></strong> <span style=\"color: red;\">!!!</span> </p> 回答1: First, HTML and PDF are not related although they were created around the same time. HTML is intended to convey higher level information such as paragraphs and tables. Although

Converting HTML to PDF using iText

夙愿已清 提交于 2019-11-25 22:58:35
问题 I am posting this question because many developers ask more or less the same question in different forms. I will answer this question myself (I am the Founder/CTO of iText Group), so that it can be a \"Wiki-answer.\" If the Stack Overflow \"documentation\" feature still existed, this would have been a good candidate for a documentation topic. The source file: I am trying to convert the following HTML file to PDF: <html> <head> <title>Colossal (movie)</title> <style> .poster { width: 120px