Hi,
We have an application (VB6) that host modules from 3rd party vendors. For printing there is a object from also one og the 3rd party vendors... Is it possible to manipulate the DevMode structs or other structs in that we way that it works like setting some properties in the Print Dialog? With other words: is it possible to create a PDF without user intervention (no specifying filename etc...)?
I think I can fix it by setting the right values in the DevMode and DevNames struct
This is our current code:
vntPrintStructArray = Array of objects to print..
With udtPrintDlg
.lStructSize = Len(udtPrintDlg)
.hwndOwner = Me.hwnd
End With
With udtDevMode
.dmDeviceName = Printer.DeviceName
.dmSize = Len(udtDevMode)
.dmFields = DM_ORIENTATION Or DM_DUPLEX
.dmOrientation = Printer.Orientation
.dmDuplex = Printer.Duplex
End With
udtPrintDlg.hDevMode = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(udtDevMode))
lngDevModePointer = GlobalLock(udtPrintDlg.hDevMode)
If lngDevModePointer > 0 Then
Call CopyMemory(ByVal lngDevModePointer, udtDevMode, Len(udtDevMode))
intReturnValue = GlobalUnlock(udtPrintDlg.hDevMode)
End If
With udtDevName
.wDriverOffset = 8
.wDeviceOffset = .wDriverOffset + 1 + Len(Printer.DriverName)
.wOutputOffset = .wDeviceOffset + 1 + Len(Printer.Port)
.wDefault = 0
.extra = Printer.DriverName & Chr$(0) & _
Printer.DeviceName & Chr$(0) & _
Printer.Port & Chr$(0)
End With
udtPrintDlg.hDevNames = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(udtDevName))
lngDevNamePointer = GlobalLock(udtPrintDlg.hDevNames)
If lngDevNamePointer > 0 Then
Call CopyMemory(ByVal lngDevNamePointer, udtDevName, Len(udtDevName))
intReturnValue = GlobalUnlock(lngDevNamePointer)
Else
MsgBox "Het is niet mogelijk om de devicename van de printer in te lezen."
Call GlobalFree(udtPrintDlg.hDevNames)
Exit Sub
End If
If PrintDialog(udtPrintDlg) Then
Call objReportGenerator.PrintReport(CVar(vntPrintStructArray), lngErrorIndex, _
udtPrintDlg.hDevNames, udtPrintDlg.hDevMode, 0)
End If
Thanks for any help,
Andre Obelink, MCSD
AcouSoft B.V.
Possible to manipulate driver from VB6?
Hello,
We provide a technical note on how to manipulate our PDF Converter with a devmode struct. You can find this technical note at the link below:
http://www.amyuni.com/downloads/tn02.htm
Hope this helps?
Thanks
We provide a technical note on how to manipulate our PDF Converter with a devmode struct. You can find this technical note at the link below:
http://www.amyuni.com/downloads/tn02.htm
Hope this helps?
Thanks
Hi,
Thanks,
Andre
I saw that article befor, but I still don't know if we can surpress the 'PrintDialog' and provide f.e. the filename in code.Jose wrote: http://www.amyuni.com/downloads/tn02.htm
Thanks,
Andre
Hello,
If you are using the PDF Converter from a third party application you need to check about this issue with your application provider. Please not that the version of the PDF Converter provided with a third party application is made to be used only from inside that application.
If you have your own Developer license of the PDF Converter you will not get the Save As dialog box because this version doesn't have a save as dialog box.
Also you can programatically specify the output file name and location by calling FileNameOptions = NoPrompt + UseFileName. For more information please check the Developers' manual "Commno Driver Interface 210.pdf".
Thanks.
If you are using the PDF Converter from a third party application you need to check about this issue with your application provider. Please not that the version of the PDF Converter provided with a third party application is made to be used only from inside that application.
If you have your own Developer license of the PDF Converter you will not get the Save As dialog box because this version doesn't have a save as dialog box.
Also you can programatically specify the output file name and location by calling FileNameOptions = NoPrompt + UseFileName. For more information please check the Developers' manual "Commno Driver Interface 210.pdf".
Thanks.