I am converting HTML to PDF using iTextSharp but am having problems with styling.
I am using iTextSharp version 5 and am able to style the tags using the following code:
StyleSheet styles = new StyleSheet();
styles.LoadTagStyle(HtmlTags.H1, HtmlTags.FONTSIZE, "16");
styles.LoadTagStyle(HtmlTags.P, HtmlTags.FONTSIZE, "10");
I then parse the HTML and style sheet using this:
List<IElement> objects = HTMLWorker.ParseToList(new StringReader(htmlText), styles);
My question is can i import an external stylesheet in instead of having to specify each one of the tags individually?
I have found this code on earlier posts:
builder.ImportStylesheet(Request.PhysicalApplicationPath + "CSS\\Stylesheet.css");
but i cannot seem to get this to work, is this from an older version of iTextSharp which has been taken out of the latest version?
That looks like its using HtmlToPdfBuilder which is not from the makers of iText or iTextSharp but might still work for you.
[EDIT]
Dead link removed, used to be http://somewebguy.wordpress.com/tag/itextsharp/
Related
It's obviously very easy to render text from PDF doc using PdfTextExtractor.GetTextFromPage. However when dealing with PDF created with embedded fonts I immediately stumbled into encoding issues.
Is there a generic method that will handle whatever font since i dont have any control on how pdf is created. My task is simple - convert pdf to text.
I've obviously searched for days before posting but could not find answer.
Thank you in advance!
ER
I am using pdf.js on(https://github.com/mozilla/pdf.js). I am able to use examples(hello world and acroforms) in gwt using JSNI. Pdf show properly now i want to use viewer.js in gwt so i convert full code in jsni. i am properly using html and css files after that no error show put still pdf also not show.
if any idea plz suggest me. Thanx in advance.
I'd like to overlay output from PrinceXML onto pages from a PDF in the file system. I'm going to build the solution in our Zend framework environment and I think I'd prefer if the solution used Zend_Pdf if that's possible.
Any suggestions? I suppose I could use something like fpdf & fpdi and somehow channel the PrinceXML output through that; but has anyone used Zend_Pdf to do an overlay with the output from PrinceXML and a static PDF "template" file?
Is there a way to directly use HTML tags in iPhone SDK? I was wondering how could I display the following text using HTML in a UILabel :
My name is Nitish and I am 24 years old.
It does not seem to be allowed. Look at following post as well:
iPhone - UILabel containing text with multiple fonts at the same time
Look at this alternative as well:
iPhone - UILabel containing text with multiple fonts at the same time (another asnwer)
You can't use UILabel to display richtext, you will have to move to CoreText.
https://github.com/Cocoanetics/NSAttributedString-Additions-for-HTML will allow you to create NASttributeString from HTML source.
This library might help.
https://github.com/elijahdou/RTLabel
Simple rich text display for iOS using html-like markups
I have two questions
Can this code be added to blogger?
Can this code embed unicode fonts? and if can, please tell me the link how to do it.
I can't see your code Kotaro ,
but any code can added to blogger and and by default embedding font in web is not available . but you can use CSS 3.0 to force user to use from the font you like, this css property is
font-url
and you can use it as any other css property like
<div style="direction:ltr;text-align:left;font-size:small;font-url:('../resources/fonts/YourFont.ttf');"> you code </div>
just note that this CSS property just available at css 3.0 and now just Firefox 3.5 supports it so I recommand you Ignore it for now,
if you want to show a speciall text just use from a font that you know your users have it, like (Arial , Tahoma , Verdana ) for windows usres
for code you can use these software
1- copysourceashtml
http://copysourceashtml.codeplex.com/
that is a opensource software
copysourceashtml http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=copysourceashtml&DownloadId=78099
2- Postable
http://vahid.nasiri.googlepages.com/postable.rar