J
John Henry
Hi all,
I have a need to invoke CutePDF from within a Python program. The
program creates an EXCEL spreadsheet and set the print area and
properties. Then I wish to store the spreadsheet in a PDF file.
xtopdf does not work well (text only). ReportLab is an overkill.
PyPDF can only shuffle PDF pages.
All I need is to say "Print this to CUTEPDF and store as xyz.pdf".
I found that this can be done in VB but I do not know VB,
unfortunately.
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
I have a need to invoke CutePDF from within a Python program. The
program creates an EXCEL spreadsheet and set the print area and
properties. Then I wish to store the spreadsheet in a PDF file.
xtopdf does not work well (text only). ReportLab is an overkill.
PyPDF can only shuffle PDF pages.
All I need is to say "Print this to CUTEPDF and store as xyz.pdf".
I found that this can be done in VB but I do not know VB,
unfortunately.
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