DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
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:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us