Hello All,
I am trying to print a PDF with a watermark.
I have the following code. It does set the text and other options like font color etc so it seems the code works.
However, I cannot get it to PRINT programmatically, (I get no output)
It works only when I open a PDF file and use File-Print manually. I have the AMYUNI PDF driver installed
(Our company has the developer license, but I dont know if the version I installed is the licensed one)
Any advise is much appreciated.
*******************************************************
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Dim pdfprinter As New CDIntf.CDIntf
Dim lRet As Long
pdfprinter.DriverInit ("Amyuni PDF Converter")
pdfprinter.SetDefaultConfig
pdfprinter.SetDefaultPrinter
lRet = pdfprinter.SetWatermark("Official Copy" & vbNewLine & Now, "Arial", 20, 0, &HFF, 50, -700, True)
pdfprinter.FileNameOptions = 64
pdfprinter.DefaultFileName = "C:\output.pdf"
lRet = ShellExecute(Me.hwnd, "Print", "C:\1.pdf", 0&, 0&, vbMaximizedFocus)
'Restore default configuration
'pdfprinter.DefaultFileName = ""
'pdfprinter.FileNameOptions = 0
'pdfprinter.SetDefaultConfig
pdfprinter.DriverEnd
End Sub
*******************************************************
Programmatically printing a PDF with watermark
Additional info
Additionally, I am using AMyUni PDF Convertor 2.08e.
We also have the AmyUni Document Converter suite 2.5g
(I am trying to get it to work with the 2.08e version with just the PDF Converter and not the entire Document Convertor Suite installation)
Thanx.
We also have the AmyUni Document Converter suite 2.5g
(I am trying to get it to work with the 2.08e version with just the PDF Converter and not the entire Document Convertor Suite installation)
Thanx.
I am trying to print just a regular PDF document.
I have existing PDFs that I want to open programmatically and then add a watermark with the text "Official Copy" to each one of them.
So the Shell Open command to open and print the document.
Also when I change the default printer to a local printer (Lexmark) t works fine and submits the Print job. But when the default printer is AMYUNI it doesnt do anything. Manual Print click operations works.
I have existing PDFs that I want to open programmatically and then add a watermark with the text "Official Copy" to each one of them.
So the Shell Open command to open and print the document.
Also when I change the default printer to a local printer (Lexmark) t works fine and submits the Print job. But when the default printer is AMYUNI it doesnt do anything. Manual Print click operations works.