Cardbox Talk


CardboxForumsCardbox Talk > "Macro Programming"

Macro Programming

Printer Macro for Virtual Printer

Posted By Post


25-Mar-2008 16:08

I was hoping someone would be in a position to help. I am not a programmer, and can only do the very simple basics of recording a macro on Cardbox for Windows. I am hoping someone can help me produce a macro to enable me to print to a virtual PDF printer (PrimoPDF) rather than my own HP printer. I would set this up as a macro on a special menu, but have absolutely no idea where to start. Can anyone help me?


25-Mar-2008 23:36

"very simple basics of recording a macro on Cardbox for Windows" is all you needto know for this:
I assume PrimoPDF is or may be installed as a printer driver (if not try CutePDF free download from http://www.cutepdf.com/Products/CutePDF/writer.asp)

Make sure you have selected the record(s)/format you want to be printed to PDF, than:
Start recording: [menu bar]File-Print - [in the "Print" window] click "Setup" - [In the "Printer Settings" window] click the Printer arrow and choose your PDF writer from the printers list - press OK Stop recording

Charles Welling

26-Mar-2008 06:44

And if you want to do some fine-tuning, you may consider using the following one-line macro, which allows you to specify the format (view). This makes it possible to have your special menu or macro button in the format you usually use for editing. Printing to your PDF printer then automatically uses the correct format. You would not have to switch formats.
Substitute YOURFORMAT (leave the quotation marks) for the name of the format you wish to use, and substitute YOURPRINTER for the name of your PDF printer. If you wish, you can copy the right name from the macro you recorded before.

This macro prints a single record, i.e. the record you are currently viewing. If that is what you want, do not change anything else.

Records.Print cbxPrintMainRecord,"YOURFORMAT",,recordposition,recordposition,"YOURPRINTER"

If however you want to print a whole selection, use the following line:

Records.Print cbxPrintMainRecord,"YOURFORMAT",,,,"YOURPRINTER"


26-Mar-2008 07:41

Iuliana thanyou for your advice however when i record the macro, use File, Print, the settings option is faded out, thus meaning I cannot change the printer to PDF. On consultation with Cardbox, they said I cannot change printer settings whilst recording a Macro.

Charles, thankyou for your advice it was very helpful, can you offer advice on how to print more than one format to the PDF printer, all formats are in the same database, I wanted to be in a position to press the special button and it prints all 3 formats to PDF


26-Mar-2008 07:44

Sorry, one final thing, one of the formats I am trying to print is the native format, so I have replaced "YOURFORMAT" with "native" or "((native))" as shown on Cardbox, but the Macro displays a "unable to find format" error


26-Mar-2008 07:54

Ignore the last post RE: the Native format, its only 7.40am sorry !!!!

My main issue is as mentioned I have 3 formats in the one database but I do not know how to tell the macro to print all 3 formats within the database. Following your advice the belwo macro works a treat, but I need to incorporate C01 - corrective action letter and T01 - terms and conditions into the macro so the print to the PDF printer with the M02 - modification quotation, which does work

Records.Print cbxPrintMainRecord,"m02 - modification quotation",,recordposition,recordposition,"primoPDF"

Charles Welling

26-Mar-2008 20:10

There is no way of using more than one format in a single print job. It would be a very illogical thing for quite a few reasons. The solution however is simple: create a single format that contains the layout and the fields of the three formats you mentioned.

It would be a very simple operation as you can copy and paste the fields from the source formats. Call the new format "PDF" or something less obvious and use this format for your PDF print.

Any field that occurs in two or even three of your original formats, and would therefore occur more than once in your "PDF" format, would have to be put in merge blocks (always a sensible thing to do when you print), because Cardbox does not allow you to have a normal field, i.e. one that can be edited, more than once in a format.

© 2010 Cardbox Software Limited   Home