vPrint - Easy Listview printing

Started by Rolf Brandt, March 16, 2010, 11:41:00 AM

Previous topic - Next topic

Rolf Brandt

vPrint.dll is a small set of printer routines.
The vPrint.inc file contains the declarations for the dll. It also has a function called LVPrintGrid to print a listview in report view to a printer.
Just add the vPrint.inc file to a project and call LVPrintGrid with the correct parameters.

vPrint.dll Routines:

vpPrnDialog
- opens a printer dialog
vpDocStart
- starts a new print document
vpDocEnd
- closes and prints the document
vpPrint
- print one or more lines to the current document
vpTextBox
- prints one line at the current position. Text that does not fit into
  the width of the box is cut off.
vpPrintLoc
- prints text to an x, y position
vpFont
- sets the font for the next line(s).
vpSetMarginLeft
- sets the left margin for the document
vpSetMarginTop
- sets the top margin
vpPageBreak
- inserts a page break
vpTextColor
- defines the text forecolor for the next line(s)
vpGetScaleMode
- gets the currently used scale mode
vpSetScaleMode
- sets the scalemode for the document
vpGetPageWidth
- gets the page width in the current scale mode
vpGetPageHeight
- gets the page height in the current scale mode
vpGetCurrentX
- gets the current horizontal (X) position in the document
vpGetCurrentY
- gets the current vertical (Y) position in the document
vpLocate
- sets the X and Y position in the document

Added 2010-03-22
vpLVPrint
- just one simple call prints all columns of a Listview control. Automatically resizes all columns proportionally to reflect the column width in the listview.

Added 2010-03-27
- Example project - Printing a Listview
- New Dll and Inclule file
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Rolf Brandt

#1
Update 2010-03-22

Added the following sub to the Dll:

vpLVPrint
Just one simple call prints all columns of a Listview control. Automatically resizes all columns proportionally to reflect the column width in the listview.

For testing it might be best to install a Pdf printer since vPrint does not have a preview mode yet. Here is a link to one that is very compact and FREE:
http://www.dopdf.com/
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Martin Francom

Rolf,
    Do you have a FF3 project example that demonstrates the use of vPrint?   

Rolf Brandt

#3
New Download with example project (see first message in thread.)

Run the exe, resize the columns in the Listview to your preference.
Click "Print".
Notice the the Column Widths are reflected in the printout. Text in a column that is to long is cut off. I will not print into the next column.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Petrus Vorster

Tried it and it works perfectly!!!!!!
Thanks a million, saves HEAPS of time!
;D
-Regards
Peter

Rolf Brandt

Thanks for the kind works. Glad you like it.

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

John Montenigro

This is amazing! Even with my limited skills, I was able to use this in just a few minutes.
Thanks Rolf!

Rolf Brandt

Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Rolf Brandt

@ John:

You might want to check my FF3 Backup Tool. It could be easy adapted for something like that too.

http://www.planetsquires.com/protect/forum/index.php?topic=2811.0

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

John Montenigro

Hi Rolf,
A looooooong time ago, in a galaxy far, far away... I tested your vPrint, and it worked fine.

Today, I'm starting a new project that could benefit from vPrint, and so I found the vPrint example program and .INC files, compiled and ran it here at the office.

Instead of printing to the printer I selected in the Print Dialog, the job went to the printer that is designated the Default Printer (which is at home...).  But if I go into Control Panel and change the Default Printer, the grid prints.

Also, no matter which settings I choose, the grid always prints in Portrait mode; ignores my selection of Landscape.

It's as if the Print Dialog values are being ignored...

I don't see the source for vPrint.DLL anywhere, so I apologize that I have to bother you...

The printer is: HP LaserJet 400 color M451dn
I'm compiling in FF 3.61, using PBWin 10.04, Windows 7 Home (64-bit).

I noticed that there's an upgrade to FF 3.62. I've downloaded it but won't have it installed till Sunday...

I appreciate any help you can offer!

Thanks,
-John


Rolf Brandt

Hi John,

I have experienced that too with one Pdf printer. Don't really know what causes it. With other printers it works ok.

I'll look for the source code and load it up.

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Petrus Vorster

Use it with PrimoPDF or PDFcreator.
They work 100% with this.
Ps do you know with this DLL how one sets the Document Name to print?
Especially with PDF printers one needs that.
-Regards
Peter