944,077 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 43823
  • ASP.NET RSS
You are currently viewing page 1 of this multi-page discussion thread
May 22nd, 2007
1

html to PDF conversion Code in c#

Expand Post »
i need a code in c# so that i can convert webpages n html pages into PDF format
Similar Threads
Reputation Points: 9
Solved Threads: 0
Newbie Poster
aerian is offline Offline
12 posts
since Apr 2007
May 22nd, 2007
0

Re: html to PDF conversion Code in c#

this is a community help forum. We help you with your problem, we don't do everything for you. Tell us what you have tried and what problems your are having and we will help you solve them. We won't do everything for you.
Reputation Points: 14
Solved Threads: 19
Posting Pro in Training
campkev is offline Offline
484 posts
since Jul 2005
May 23rd, 2007
0

Re: html to PDF conversion Code in c#

out there got alot PDF convertion DLL, if u need for non bunisess use.
Or u can export your file to excel format using .net and then using microsoft 2007 to convert it to PDF.
Reputation Points: 10
Solved Threads: 2
Newbie Poster
kokkee is offline Offline
20 posts
since May 2007
May 24th, 2007
0

Re: html to PDF conversion Code in c#

if you can wait till tomorrow i have code snippet that will perfectly work for you. See you tomorrow when i get to office
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Tunde is offline Offline
2 posts
since Jan 2005
May 25th, 2007
0

Re: html to PDF conversion Code in c#

Hi,

Here is a .NET 2.0 library for html to pdf conversion: www.html-to-pdf.net.

Here is some code sample from their website:

ASP.NET Syntax (Toggle Plain Text)
  1. PdfConverter pdfConverter = new PdfConverter();pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal;pdfConverter.PdfDocumentOptions.ShowHeader = true;pdfConverter.PdfDocumentOptions.ShowFooter = true;pdfConverter.PdfDocumentOptions.LeftMargin = 5;pdfConverter.PdfDocumentOptions.RightMargin = 5;pdfConverter.PdfDocumentOptions.TopMargin = 5;pdfConverter.PdfDocumentOptions.BottomMargin = 5;pdfConverter.PdfDocumentOptions.UseMetafileFormat = true;pdfConverter.PdfDocumentOptions.ShowHeader = false;//pdfConverter.PdfHeaderOptions.HeaderText = "Sample header: " + TxtURL.Text;//pdfConverter.PdfHeaderOptions.HeaderTextColor = Color.Blue;//pdfConverter.PdfHeaderOptions.HeaderDescriptionText = string.Empty;//pdfConverter.PdfHeaderOptions.DrawHeaderLine = false;pdfConverter.PdfFooterOptions.FooterText = "Sample footer: " + TxtURL.Text + ". You can change color, font and other options";pdfConverter.PdfFooterOptions.FooterTextColor = Color.Blue;pdfConverter.PdfFooterOptions.DrawFooterLine = false;pdfConverter.PdfFooterOptions.PageNumberText = "Page";pdfConverter.PdfFooterOptions.ShowPageNumber = true;pdfConverter.LicenseFilePath = System.IO.Path.Combine(Server.MapPath("~"), "Bin");byte[] downloadBytes = pdfConverter.GetPdfFromUrlBytes(url);System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;response.Clear();response.AddHeader("Content-Type", "binary/octet-stream");response.AddHeader("Content-Disposition", "attachment; filename=" + downloadName + "; size=" + downloadBytes.Length.ToString());response.Flush();response.BinaryWrite(downloadBytes);response.Flush();response.End();

See the original code sample here:
http://www.html-to-pdf.net/Support.aspx#csharp
Reputation Points: 10
Solved Threads: 0
Newbie Poster
flo2007 is offline Offline
1 posts
since May 2007
May 31st, 2007
0

Re: html to PDF conversion Code in c#

Reputation Points: 10
Solved Threads: 0
Newbie Poster
winnovative is offline Offline
4 posts
since May 2007
Oct 20th, 2007
0

Re: html to PDF conversion Code in c#

Hi,

The new version 3.2.3 of the Winnovative HTML to PDF converter for .NET is now faster and has a lot of new features like CSS page breaks, live http links in PDF, keep together feature for any HTML element, password protection, embedded fonts, etc.
Here you can see all the HTML to PDF converter features. If you liked the version 2.x you'll love 3.2.3.

Regards,
Florin
Reputation Points: 10
Solved Threads: 0
Newbie Poster
winnovative is offline Offline
4 posts
since May 2007
Dec 13th, 2007
0

Re: html to PDF conversion Code in c#

hi all ...
is there any free dll for html to pdf conversion, to be used in asp.net 2.0 ?
which doesn't show any "Evaluation Version" message in the converted file ...
please help ..
thanks ..
Last edited by hunter_kriss; Dec 13th, 2007 at 1:49 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hunter_kriss is offline Offline
2 posts
since Dec 2007
Dec 13th, 2007
0

Re: html to PDF conversion Code in c#

hi ...

i tried this library, but this is giving some errors ...
pdfConverter.LicenseFilePath = System.IO.Path.Combine(Server.MapPath("~"), "Bin");
i suppose i am not having that licence ...

then what i did is, commented this piece of code ...
finally the file is generated as i wanted but with a message written in file as "Evaluation Version ..."

is there any other other method so that i can bypass the message of "Evaluation Version" in the generated pdf.

please help ...
thanks ...





Click to Expand / Collapse  Quote originally posted by flo2007 ...
Hi,

Here is a .NET 2.0 library for html to pdf conversion: www.html-to-pdf.net.

Here is some code sample from their website:

ASP.NET Syntax (Toggle Plain Text)
  1. PdfConverter pdfConverter = new PdfConverter();pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal;pdfConverter.PdfDocumentOptions.ShowHeader = true;pdfConverter.PdfDocumentOptions.ShowFooter = true;pdfConverter.PdfDocumentOptions.LeftMargin = 5;pdfConverter.PdfDocumentOptions.RightMargin = 5;pdfConverter.PdfDocumentOptions.TopMargin = 5;pdfConverter.PdfDocumentOptions.BottomMargin = 5;pdfConverter.PdfDocumentOptions.UseMetafileFormat = true;pdfConverter.PdfDocumentOptions.ShowHeader = false;//pdfConverter.PdfHeaderOptions.HeaderText = "Sample header: " + TxtURL.Text;//pdfConverter.PdfHeaderOptions.HeaderTextColor = Color.Blue;//pdfConverter.PdfHeaderOptions.HeaderDescriptionText = string.Empty;//pdfConverter.PdfHeaderOptions.DrawHeaderLine = false;pdfConverter.PdfFooterOptions.FooterText = "Sample footer: " + TxtURL.Text + ". You can change color, font and other options";pdfConverter.PdfFooterOptions.FooterTextColor = Color.Blue;pdfConverter.PdfFooterOptions.DrawFooterLine = false;pdfConverter.PdfFooterOptions.PageNumberText = "Page";pdfConverter.PdfFooterOptions.ShowPageNumber = true;pdfConverter.LicenseFilePath = System.IO.Path.Combine(Server.MapPath("~"), "Bin");byte[] downloadBytes = pdfConverter.GetPdfFromUrlBytes(url);System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;response.Clear();response.AddHeader("Content-Type", "binary/octet-stream");response.AddHeader("Content-Disposition", "attachment; filename=" + downloadName + "; size=" + downloadBytes.Length.ToString());response.Flush();response.BinaryWrite(downloadBytes);response.Flush();response.End();

See the original code sample here:
http://www.html-to-pdf.net/Support.aspx#csharp
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hunter_kriss is offline Offline
2 posts
since Dec 2007
Dec 28th, 2007
0

Re: html to PDF conversion Code in c#

With the Winnovative PDF Creator for .NET you can perform the HTML to PDF conversion with only a few lines of code.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
winnovative is offline Offline
4 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: asp menu on mouse out
Next Thread in ASP.NET Forum Timeline: Object cannot be cast from dbnull to other types





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC