By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,543 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,543 IT Pros & Developers. It's quick & easy.

convert any text file into pdf file

P: 40
Hi!
can any one help me by providing the method when i open any text file and convert into pdf format. I searched on the net and i got some code but i am not understanding this code and it also produce error on the highlited line. for converting the file can i have to do the refrence to adobe liberary please tell me

Dim wrd As New Word.Application
Dim doc As Word.Document
wrd.Visible = False
wrd.ScreenUpdating = False
wrd.ActivePrinter = "Acrobat Distiller"
'Open the document
Set doc = wrd.Documents.Open("d:\abc\test.doc")
'Print it to a PostScript file using Distiller
doc.PrintOut False, False, , "d:\abc\test.ps", , , , , , , True
doc.Close False
wrd.Quit False
Set doc = Nothing
Set wrd = Nothing
'Now call distiller to convert the postscript file to PDF
Dim acr As New ACRODISTXLib.PdfDistiller//user defined type not defined
acr.bShowWindow = False
acr.FileToPDF "d:\abc\test.ps", "d:\abc\test.pdf", True
'acr.FileToPDF "d:\abc\test.ps", "d:\abc\test.pdf", 1
Set acr = Nothing
'Delete the old PS file
Kill "d:\abc\test.ps"
'Done

Exit Sub
PDF_error:
doc.Close False
wrd.Quit False
Set doc = Nothing
Set wrd = Nothing
Set acr = Nothing
Mar 13 '08 #1
Share this Question
Share on Google+
2 Replies


debasisdas
Expert 5K+
P: 8,127
Do you have the third party component / DLL in your system and is that referenced to your project ?
Mar 13 '08 #2

P: 40
i don't have DLL in my systems related to this program


Do you have the third party component / DLL in your system and is that referenced to your project ?
Mar 13 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.