We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

HTML To PDF

Hi to all!!!! I'm new using this product, I only have the evaluation. I'm working on a report for the company I work for. I'm in need to convert the report I made to PDF, so what I'm trying to do is convert the report to PDF (HTML to PDF). Im working with VS2005.NET using C#. I tried the product HTMLTOPDF with the dll ephtmltopdf. It works but when I need to create a large report it has problems so I'm trying this product. My question is what dll's I need to install on my Bin Folder to generate the PDF file from my html? Also I will like some code on C# to export what I have.

Thanks!!!

4 Replies

AT Angel Torres June 17, 2009 02:20 PM UTC

I made the code and it works great. My question now is, how can I insert the number of pages in the footer of every page.


AT Angel Torres June 17, 2009 02:55 PM UTC

Also how can I avoid PageBreaking on the pdf because I have a Big GridView Report with a Chart on the end of the report and it is cutting the Chart Information and some parts of the Report.


AT Angel Torres June 17, 2009 06:58 PM UTC

I use this code and it worked with the version 5.102.1.47 but when i changed the dlls to version 7.203.0.37 it does not work. What can I do to make it work on the newest version.

using Syncfusion.Pdf;
using Syncfusion.Pdf.Shared;
using Syncfusion.HtmlConverter;

string myURL = Request.Url.ToString();
PDFDocument doc = new PDFDocument();
doc.Compression = CompressionLevel.Normal;

IPDFGraphicState properties = doc.CreateGraphicState();
properties.SplitImages = true;
properties.BreakBehavior = AutoBreakBehavior.MultiLineTextBreak;

using (HtmlConverter html = new HtmlConverter())
{
m_converter = html;
//string path;

using (System.Drawing.Image bmp = html.ConvertToImage(myURL, ImageType.Bitmap))
{
if (bmp != null)
{
doc.LastPage.Margins.All = 0;
SizeF dest = new SizeF();
if (bmp.Width > doc.LastPage.DrawingWidth)
{
dest = new SizeF(doc.LastPage.DrawingWidth, -1);
}
else
{
dest = bmp.Size;
}
doc.LastPage.Graphics.DrawImage(PointF.Empty, bmp, dest, properties);
doc.LastPage.Margins.Bottom = 65;
}
}

string path = "htmltopdf.pdf";
doc.Save(path, Response, HttpReadType.Save);
m_converter = null;

}


KM Karthik M Syncfusion Team June 24, 2009 03:32 PM UTC

Hi Angel,

Thank you for your interest in Essential PDF.

Basically, starting from our Essential PDF v5.2.0.25, we had introduced our new version of Essential PDF which is the complete re-write of our older Pdf version with improved performance and easy to use APIs. Since the code-snippet which you have used corresponds to our older version of the legacy PDF, this will not work with our newer version.

Please do find the documentation link explaining the HtmlToPDF conversion from the below location.

http://help.syncfusion.com/ug_72_new/pdf/HTMLToPDF.html

Also, please do find our online sample from the below location.

http://samples.syncfusion.com/ASPNET/7.2.0.20/web/pdf.web/samples/3.5/Product%20Showcase/HtmlToPdf/CS/default.aspx

Please try this and let us know if you have any questions.

Regards,
Karthik

Loader.
Live Chat Icon For mobile
Up arrow icon