|
|
|
start date: Thu, 23 Aug 2007 10:23:35 +0200,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Morten Snedker
|
|
2
Mark Rae [MVP]
|
|
3
Morten Snedker
|
|
4
Mark Rae [MVP]
|
HTML-file to pdf
From an aspx I wish to grab a html-file from the same directory and
push it to PDF via Response.ContentType = "application/pdf".
Alternatively the html-content can be held in a string variable, which
can be used instead.
Can someone push me in the right direction as to how?
Regards /Snedker
Date:Thu, 23 Aug 2007 10:23:35 +0200
Author:
|
Re: HTML-file to pdf
"Morten Snedker" wrote in message
news:%23ZlEJ7V5HHA.5360@TK2MSFTNGP03.phx.gbl...
> From an aspx I wish to grab a html-file from the same directory and push
> it to PDF via Response.ContentType = "application/pdf".
In order to stream a PDF file, you need to actually have a PDF file to
stream in the first place - you can't e,g, open an HTML file and just
"pretend" it's a PDF by changing the MIME type...
There are many utilities which will convert an HTML file to PDF:
http://www.google.co.uk/search?sourceid=navclient&aq=t&hl=en-GB&ie=UTF-8&rlz=1T4GGIH_en-GBGB220GB220&q=HTML+PDF+convert
> Alternatively the html-content can be held in a string variable, which can
> be used instead.
using System.IO;
string strFileContents = String.Empty;
using (StreamReader objSR = new StreamReader("TestFile.txt"))
{
strFileContents = objSR.ReadToEnd();
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Date:Thu, 23 Aug 2007 09:55:36 +0100
Author:
|
Re: HTML-file to pdf
Thanks for your response. I came across http://www.primopdf.com/ which
will generate the PDF. It's quite free, which is the way I prefer it. :-)
Regards /Snedker
Date:Thu, 23 Aug 2007 12:37:47 +0200
Author:
|
Re: HTML-file to pdf
"Morten Snedker" wrote in message
news:OXylUGX5HHA.4928@TK2MSFTNGP05.phx.gbl...
> Thanks for your response. I came across http://www.primopdf.com/ which
> will generate the PDF. It's quite free, which is the way I prefer it. :-)
The desktop version which installs a printer driver and allows PDF
conversion that way is free - I don't think any of the server-side versions
are, though...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Date:Thu, 23 Aug 2007 12:05:31 +0100
Author:
|
|
|