473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HTML to PDF

Hi all,

I am looking for some .NET code which can convert HTML to a PDF.
I have looked the internet bad without any luck so far.

I have found the iText.NET this has alot of sample but couldn't find a
sample for HTML to PDF.
Besides I get the error 'Provider for javax.xml.parsers.SAXParserFactory
cannot be found'
For every example I try.
Also the ABC PDF converter I tried but couldn't figure out how to get this
working also.
So little documentation :-(

Can somebody give me a simple example maybe?
Wihich DLL's I need for this conversion?

Many thanks,

Class

Jan 4 '07 #1
7 7250
your options are limited. itext (or the c# version itextsharp) only
handle very simple html. last time i used it, i rewrote the table
support to support nested tables (advantage of open source), but it
still only handled very simple xhtml.

activepdf is the market leader for a 3rd party product. they use IE as
rendering engine, so their html support is very good.
-- bruce (sqlwork.com)

Class wrote:
Hi all,

I am looking for some .NET code which can convert HTML to a PDF.
I have looked the internet bad without any luck so far.

I have found the iText.NET this has alot of sample but couldn't find a
sample for HTML to PDF.
Besides I get the error 'Provider for javax.xml.parsers.SAXParserFactory
cannot be found'
For every example I try.
Also the ABC PDF converter I tried but couldn't figure out how to get this
working also.
So little documentation :-(

Can somebody give me a simple example maybe?
Wihich DLL's I need for this conversion?

Many thanks,

Class
Jan 4 '07 #2
Get WebSuperGoo's ABCPDF, and look around more for the documentation and
"quick start." It is very well documented and easy to use; the "getting
started" stuff is as basic as can be.

-KF

"Class" <No****@klaas.comwrote in message
news:ul**************@TK2MSFTNGP06.phx.gbl...
Hi all,

I am looking for some .NET code which can convert HTML to a PDF.
I have looked the internet bad without any luck so far.

I have found the iText.NET this has alot of sample but couldn't find a
sample for HTML to PDF.
Besides I get the error 'Provider for javax.xml.parsers.SAXParserFactory
cannot be found'
For every example I try.
Also the ABC PDF converter I tried but couldn't figure out how to get this
working also.
So little documentation :-(

Can somebody give me a simple example maybe?
Wihich DLL's I need for this conversion?

Many thanks,

Class

Jan 5 '07 #3
Hi Kenfine,

Thanks for your response but I must disagree with you.
IThe first product I checked out was the ABCPDF but...

There example of the conversion says:
virtual int AddHtml(string text)
virtual int AddHtml(string dummy, int chainid)
Doc theDoc = new Doc();
theDoc.FontSize = 72;
theDoc.AddHtml("<b>Gallia</best omnis divisa in partes tres, quarum unam
incolunt <b>Belgae</b>, aliam <b>Aquitani</b>, tertiam qui ipsorum lingua
<b>Celtae</b>, nostra <b>Galli</bappellantur.");
theDoc.Save(Server.MapPath("docaddhtml.pdf"));
theDoc.Clear();

This example doesn't work.
In fact the AddHtml(string text) doesn't exists!!
I tried the version 5 of this component.

Thanks,
Class

<ke*****@nospam.nospamschreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
Get WebSuperGoo's ABCPDF, and look around more for the documentation and
"quick start." It is very well documented and easy to use; the "getting
started" stuff is as basic as can be.

-KF

"Class" <No****@klaas.comwrote in message
news:ul**************@TK2MSFTNGP06.phx.gbl...
>Hi all,

I am looking for some .NET code which can convert HTML to a PDF.
I have looked the internet bad without any luck so far.

I have found the iText.NET this has alot of sample but couldn't find a
sample for HTML to PDF.
Besides I get the error 'Provider for javax.xml.parsers.SAXParserFactory
cannot be found'
For every example I try.
Also the ABC PDF converter I tried but couldn't figure out how to get
this working also.
So little documentation :-(

Can somebody give me a simple example maybe?
Wihich DLL's I need for this conversion?

Many thanks,

Class


Jan 5 '07 #4
Class,
Thanks for your response but I must disagree with you.
IThe first product I checked out was the ABCPDF but...
I agree with Kenfine. I've used AbcPdf.Net version 5, and it has worked
fine for me.

The way I typically use it is to write a function that creates the html
document and returns it as a string. This function creates a StringBuilder
and then repeatedly calls the StringBuilder's AppendLine method to add all
of the lines of the html file. Then I pass the html string returned by that
function to the Doc.AddImageHtml method. It has always worked fine for me.

--Rob Roberts
Jan 5 '07 #5
On Thu, 4 Jan 2007 19:59:59 +0100, Class wrote:
Hi all,

I am looking for some .NET code which can convert HTML to a PDF.
I have looked the internet bad without any luck so far.

I have found the iText.NET this has alot of sample but couldn't find a
sample for HTML to PDF.
Besides I get the error 'Provider for javax.xml.parsers.SAXParserFactory
cannot be found'
For every example I try.
Also the ABC PDF converter I tried but couldn't figure out how to get this
working also.
So little documentation :-(

Can somebody give me a simple example maybe?
Wihich DLL's I need for this conversion?

Many thanks,

Class
Try SharpPDF
--
Bits.Bytes
http://bytes.thinkersroom.com
Jan 6 '07 #6
Hi Rob,

aha! okey, I will try the Doc.AddImageHtml method instead.
I'll let you know.

Thanks,
Class
"Rob Roberts" <ro************@AndThisToo.pcisys.netschreef in bericht
news:ui**************@TK2MSFTNGP04.phx.gbl...
Class,
>Thanks for your response but I must disagree with you.
IThe first product I checked out was the ABCPDF but...

I agree with Kenfine. I've used AbcPdf.Net version 5, and it has worked
fine for me.

The way I typically use it is to write a function that creates the html
document and returns it as a string. This function creates a
StringBuilder and then repeatedly calls the StringBuilder's AppendLine
method to add all of the lines of the html file. Then I pass the html
string returned by that function to the Doc.AddImageHtml method. It has
always worked fine for me.

--Rob Roberts


Jan 7 '07 #7
You can try ABCpdf. which convert html to PDF

using (StreamReader sr = new StreamReader("just place full path of ur html file"))
while ((line = sr.ReadLine()) != null)
{
str = str + line + "\n";
}
Doc theDoc = new Doc();
theDoc.Rect.Inset(10, 50);
theDoc.Page = theDoc.AddPage();
int theID;
theID = theDoc.AddImageHtml(str);
while (true)
{
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
for (int i = 1; i <= theDoc.PageCount; i++)
{
theDoc.PageNumber = i;
theDoc.Flatten();
}
theDoc.Save("path where u want 2 save"+pagedhtml.pdf");
theDoc.Clear();

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Jan 11 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
1
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML...
33
by: LRW | last post by:
http://gto.ie-studios.net/index.php When you view the above site in IE, if the 1st of the three product images is tall enough to push the cell down a couple of pixels, IE somehow doesn't show...
0
by: Boris Ammerlaan | last post by:
This notice is posted about every week. I'll endeavor to use the same subject line so that those of you who have seen it can kill-file the subject; additionally, Supersedes: headers are used to...
9
by: Patient Guy | last post by:
Taking the BODY element as an example, all of its style attributes ('alink', 'vlink', 'background', 'text', etc.) are deprecated in HTML 4.01, a fact noted in the DOM Level 2 HTML specification. ...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
6
by: Guy Macon | last post by:
cwdjrxyz wrote: HTML 5 has solved the above probem. See the following web page: HTML 5, one vocabulary, two serializations http://www.w3.org/QA/2008/01/html5-is-html-and-xml.html
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.