> 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=1T4
GGIH_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();
}

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Morten Snedker - 23 Aug 2007 11:37 GMT
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
Mark Rae [MVP] - 23 Aug 2007 12:05 GMT
> 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...

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
bruce barker - 23 Aug 2007 16:32 GMT
almost all the html to pdf converters work by loading the html in an ie
instance, then having ie print to a fake printer via the pdf driver and
capturing the printer output.
there are some converters that do the paring, but they are limited to
simple html or more often simple xhtml.
-- bruce (sqlwork.com)
>> 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.
[quoted text clipped - 3 lines]
> conversion that way is free - I don't think any of the server-side
> versions are, though...