Sample Code (PDF Writer with programmatic access only)
The sample code below convert a MS Word file to a PDF file in a
Visual Basic application.
Private Sub Print_PDF()
Dim lRetVal As Long
Dim hKey As Long
Dim sValue As String
lRetVal =
RegCreateKeyEx(HKEY_CURRENT_USER, "Software\Custom PDF
Printer", _
0&, vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
_
0&, hKey, lRetVal)
sValue =
"C:\Sample.pdf"
RegSetValueExString hKey, "OutputFile",
0&, REG_SZ, sValue, Len(sValue)
sValue = "1"
RegSetValueExString hKey, "BypassSaveAs",
0&, REG_SZ, sValue, Len(sValue)
Dim worddoc As Word.Document
Set worddoc =
wordapp.Documents.Open("C:\Sample.doc")
wordapp.ActivePrinter = "Custom
PDF Printer"
wordapp.PrintOut
worddoc.Close
sValue = "0"
RegSetValueExString hKey, "BypassSaveAs",
0&, REG_SZ, sValue, Len(sValue)
RegCloseKey (hKey)
End Sub
|
Overview
|
Developer Kit
|
Sample Code
|
System Requirements
|
License and Price
|
|