Could you give me the vb6 code?
That would help a lot.
Main Topics
Browse All TopicsHello,
How do I create a .pdf file from a Word .doc?
I'm using PDFCreator and VB 08 Pro.
The code below creates the .pdf file, but when I try to open it, I get the following error message:
"Adobe could not open 'tt.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)...
Thank you for your help.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Option Explicit
Private WithEvents myPDFCreator As PDFCreator.clsPDFCreator
Pr
Private
Priva
Private readyState As Boolean
Private Sub commands_Click(Index As Integer)
Select Case Index
Case 0
PrintIt 0
End Select
End Sub
Private Sub Form_Load()
Set pdfError = New PDFCreator.clsPDFCreatorEr
Set myPDFCreator = New PDFCreator.clsPDFCreator
'Set pdfOpt = New PDFCreator.clsPDFCreatorOp
With myPDFCreator
'.cVisible = True
If .cStart("/NoProcessingAtSt
If .cStart("/NoProcessingAtSt
commands(0).Enabled = False
Exit Sub
End If
'.cVisible = True
End If
' Get the options
Set pdfOpt = .cOptions
.cClearCache
'readyState = False
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
If readyState = False Then
DoEvents
myPDFCreator.cClose
End If
DoEvents
myPDFCreator.cClose
Set myPDFCreator = Nothing
Set pdfError = Nothing
Set pdfOpt = Nothing
End Sub
Private Sub PrintIt(ByVal Filetyp As Long)
Dim fname As String, fi As String, DefaultPrinter As String
Dim opt As New PDFCreator.clsPDFCreatorOp
With Me.CommonDialog1
'.MultiSelect = False
'.CheckFileExists = True
'.CheckPathExists = True
.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"
.ShowOpen
End With
If CommonDialog1.FileName <> "" Then
fi = (CommonDialog1.FileName)
' If CommonDialog1.Name <> "" Then
' If InStr(CommonDialog1.Name, ".", VbCompareMethod) > 1 Then
' fname = Mid(fi.Name, 1, InStr(CommonDialog1.Name, ".", CompareMethod.Text) - 1)
' Else
' fname = CommonDialog1.Name
' End If
' End If
If Not myPDFCreator.cIsPrintable(
MsgBox "File is not printable!", vbExclamation
Exit Sub
End If
Set opt = myPDFCreator.cOptions
With opt
.UseAutosave = 1
.UseAutosaveDirectory = 1
.AutosaveDirectory = "C:\" 'fi.DirectoryName
.AutosaveFormat = Filetyp
If Filetyp = 5 Then
.BitmapResolution = 72
End If
.AutosaveFilename = "alvin"
End With
With myPDFCreator
.cClearCache
DefaultPrinter = .cDefaultPrinter
.cDefaultPrinter = "PDFCreator"
.cPrintFile (Me.CommonDialog1.FileName
readyState = False
.cPrinterStop = False
End With
Set myPDFCreator.cOptions = opt
With Timer1
.Interval = maxTime * 1000
.Enabled = True
Do While Not readyState And .Enabled
DoEvents
Loop
.Enabled = False
End With
If Not readyState Then
MsgBox "Creating printer test page as pdf." & vbCrLf & vbCrLf & _
"An error is occured: Time is up!", vbExclamation
End If
myPDFCreator.cPrinterStop = True
myPDFCreator.cDefaultPrint
End If
Set opt = Nothing
End Sub
Private Sub mypdfcreator_eReady()
myPDFCreator.cPrinterStop = True
readyState = True
End Sub
Private Sub mypdfcreator_eError()
Set pdfError = myPDFCreator.cError
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
End Sub
i hope this code give u idea...
game-master
game-master and bruintje,
Thank you both for your input. I couldn't translate the vb06 code into vb08... bruintje's suggestion didn't help me solve the problem.
I ended up finding my own solution through groupes.codes-sources.com (http://groupes.codes-sour
Thank you,
Rick
Business Accounts
Answer for Membership
by: game-masterPosted on 2009-04-02 at 17:40:50ID: 24055871
good morning!
i have used PDFCreator to create a pdf file, unfortunately i used vb6 not .net.
and it works correctly...
game-master