Click here to Skip to main content
11,496,146 members (369 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: ASP.NET
Hi everey one,is possible export Html with External CssStyles( like background color,image) into pdf in ? if it possible please give suggestion to me as soon possible....
Posted 5-Feb-13 17:30pm
Edited 5-Feb-13 18:20pm
Sergey Alexandrovich Kryukov at 5-Feb-13 22:54pm
First of all, please don't re-post. I removed one redundant questions.

Apparently, you can create PDF, just use iTextSharp (but why?!).
What's the problem? What do you mean by giving a solution? You cannot expect that someone do your work for you...
Suresvision at 5-Feb-13 23:21pm
Hi,is possible export Html or aspx table with External CssStyles( like background color,image) into pdf in ? if it possible please give suggestion to me as soon possible....
Sergey Alexandrovich Kryukov at 5-Feb-13 23:33pm
What suggestions do you mean? This is just work to do...
(Was that soon enough? :-))
Suresvision at 5-Feb-13 23:51pm
i am saving html to pdf but that pdf not showing css styles in pdf, i used itextsharp.
Sergey Alexandrovich Kryukov at 5-Feb-13 23:55pm
If is not supposed to "show" anything, you need to parse and interpret CSS. Nothing can do it but your code. There is no such thing as a miracle...
Look at the wkhtmltopdf[^] project, which is “simple shell utility to convert html to pdf using the webkit rendering engine, and qt.” I'm using this in my project about two years and it works just fine.
wkhtmltopdf myhomepage.pdf
for local file:
wkhtmltopdf c:\path\to\file.html file.pdf
.html extension is mandatory, in case you want to work with temporary file!

For executing another programs from your code use Process Class[^] with ProcessStartInfo Class[^].
You can use some 3rd party libraries to convert HTML to PDF. For examle you may want to look at Elerium HTML to PDF component. It allows to convert html string/file/url to PDF including styles, but it is not free. All you need is HTML file or string that contains a reference to an external css file.

You can also try iTextSharp. It is free but i don't know does it work with external styles correctly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 11 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100