Newbie - sample code?

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
whoit
Posts: 12
Joined: Tue Jul 19 2005

Newbie - sample code?

Post by whoit »

I'm looking for VB6 sample code - just some basic stuff to get me going.

Right now, I have a simple app where I print to the vb Printer object, and render some pictures directly to the DC of the printer.

Once I initialize the Amyuni printer, can I then start using the Printer object, i.e.
Printer.Print "hello"
Printer.PageSize= 5
etc?

When do I use the Amyuni specific properties/methods vs the Printer object properties/methods?

Thanks.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Please feel free to downlaod our Access Technical Note from: http://www.amyuni.com/en/support/technotes.html
The code is in VBA, you can easily 'translate' it to VB.

You can use the Printer object if you set it to the PDF Printer othewise you can use CDIntf to set the properties of the PDF Printer. For more information about CDintf please check the developers' manual "Common Driver Interface 250.pdf" that you got with the evaluation version.

Hope this helps.
whoit
Posts: 12
Joined: Tue Jul 19 2005

Post by whoit »

Thanks.

I got pieces of code from the CDI reference and that worked fine.
paulera
Posts: 5
Joined: Thu Jan 11 2007
Location: Brazil

Post by paulera »

a little example for ya:

Code: Select all

'Initialize the PDF printer
Dim pdfprinter As New CDIntf.CDIntf
pdfprinter.DriverInit("PDF Compatible Printer Driver")
'you can try  pdfprinter.DriverInit("Amyuni PDF Converter")

'Configures printer
pdfprinter.DefaultFileName = "c:\test.pdf"
pdfprinter.FileNameOptions = 1 + 2
pdfprinter.SetDefaultConfig
pdfprinter.SetDefaultPrinter

'Prints the document, doesn't matter how
Call PrintMyDocument

'Restore default configuration
pdfprinter.DefaultFileName = ""
pdfprinter.FileNameOptions = 0
pdfprinter.SetDefaultConfig

'Finish the job
pdfprinter.DriverEnd
This way, you will set the PDF cenverter as the default printer before print your document. When you call the DriverEnd method, the original default printer will be restored.

Maybe help.

Bye
Post Reply