itextSharp font size not matches when converting html to pdf

We are using itextsharp library in one of our project for creating pdf from html. Everything works fine, but PDF does not create exact replica of html text.

Like for example if html is like :-

<font size="3"><font face="Courier New, Courier, monospace">Plesae <strong>enter     
your</strong> text in below editor and click <font size="4">Generate button to view pdf 
from html to publish add in india</font></font>

and below code is being used to generate PDF then the font size are not properly taken by itext

StringReader strReader = new StringReader(content);
arrList = HTMLWorker.parseToList(strReader, null);

Paragraph para = new Paragraph();  
for (int k = 0; k < arrList.size(); ++k) {                   

We have made changes in library for mapping font size like if font size 3 is given then take 12 but still exact replica is not being created, may be for Courier 3 we need to map 13, 14 what i really looking forward is, if there is any formula for setting font size accrodingly. The Html being generated from CkEditor.

how to apply font properties on while passing html to pdf using itextsharp

I am converting html to pdf using itextsharp and I want to set the font size for tags. How can I do this? Currently I am using: StyleSheet styles = new StyleSheet(); styles.LoadTagStyle(HtmlTags.SPAN,

Absolute position when converting HTML to PDF with iTextSharp

I am using iTextSharp to convert HTML to PDF and it doesn’t seem to work with absolutely positioned elements. For example I have this HTML file: <html> <body> <p style=position: absolu

ITextSharp HTML to PDF?

I’d like to know if ITextSharp has the capability of converting HTML to PDF. Everything I will convert will just be plain text but unfortunately there is very little to no documentation on ITextSharp

Convert HTML to PDF using itextsharp

when converting html to pdf using itextsharp the style iam applying with css for the web page is not working in the converted pdf. here is my css code : <style type=text/css> .cssformat { widt

Alternatives to iTextSharp for Converting HTML to PDF

I want to convert an HTML file to PDF using iTextSharp. I used this code. I then did the following to convert it to pdf: HTMLWorker htmlWorker = new HTMLWorker(document); htmlWorker.Parse(new StringR

HTML to PDF – CSS in iTextSharp

I am trying to build a pdf file from html code using iTextSharp. Here is a sample of the HTML: <div style=height:400px; font-family:Courier; font-size:9px> herrow </div> <span style=

Convert HTML To pdf using itextsharp in

I am having a prblem in converting html to pdf The code which i used for conversion is as follows using iTextSharp.text; using iTextSharp.text.html.simpleparser; using iTextSharp.text.pdf; using Syste

ItextSharp Html to pdf arabic characters are not combining in pdf

I am converting html to pdf using itextsharp Problem i am having is that any arabic sentence like يسعى برنامج الشيخ خليفة للتميز الحكومي إلى تحقيق when exported each characters in every word is becomi

Splitted PDF size is larger when using the iTextSharp

Dear Team, In my application, i want to split the pdf using itextsharp. If i upload PDF contains 10 pages with file size 10 mb for split, After splitting the combine file size of each pdfs will result

iTextSharp – html to pdf with background color for font

I’m using iTextSharp to convert HTML to a PDF and email it. It’s working fine, except it doesn’t seem to support the background style. This is the code I’m using to parse the HTML private MemoryStr


You need to use LoadTagStyle to handle it.


StyleSheet styles = new StyleSheet();

styles.LoadTagStyle(HtmlTags.P, HtmlTags.FONTSIZE, "16");

arrList = HTMLWorker.parseToList(strReader, style);

And add tag

to wrap your whole thing