Ok, I made it an ActiveX DLL (COM component), you gotta install the dll on
the server and register it. It only converts a text file to PDF on the
server, so you got to use the FileSystemObject to create the text, then
convert it to PDF using the component, then delete the txt file using
the fso, then allow the user to download it or see it using the Stream
object and then delete the pdf with the fso. It's actually not that
complicated... Here's how to use the component:
'Create the component object
Set objPDF = Server.CreateObject("PDFbyFernan.MakePDF")
objPDF.SourceFile = "c:\www\text.txt" 'Physical path to the text file (use Server.MapPath to convert the virtual path)
objPDF.TargetFile = "c:\www\file.pdf" 'Physical path to the PDF file we're gonna make.
objPDF.RecordsPerPage = 60 'How many lines per page on the PDF
objPDF.Width = 80 'How many characters per line
objPDF.Font = "Arial" 'What font we want to use on the PDF objPDF.CreatePDFFile 'Make the pdf file!
'Release object
Set objPDF = Nothing
I could make it a pure ASP class but it's quite a bit of work and I'm not about to that for free :-)...
I've setup a demo, but I put a text file already on the server that
only contains the lines "Hello World" so you only get to specify the
name for the PDF and all you'll see on it is hello world but it proves
that the component works!, here's the demo:
http://lab.uznetworkz.com/text2pdf_component/
and you can download the component here:
http://lab.uznetworkz.com/text2pdf_component/PDFbyFernan.zip
It'll only be available from there for 24 hrs. After that if anyone
wants it PM me... I might work on it this weekend and add features like
tables etc., and the ability to create the PDF 'on the fly' and send it
to the client browser rather than having to go thru all this, but might
not release it for free so better get this one while it's available...
:-)
Edited by fernan82