Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print 2-sided Crystal Report from VB App? 1

Status
Not open for further replies.

CraigBest

Programmer
Aug 1, 2001
545
0
0
US
I have a VB Application that uses the Crystal Reports 8.5 OCX control to view and print a crystal report. Currently it prints single-sided. My users have asked if I could make it print double-sided to save paper. Is there a way I can make the Crystal OCX control print double-sided? (The printer can do this, BTW).

Thanks for any help you can offer.


CraigHartz
 
Sorry, make that the Crystal Reports Viewer DLL I'm using, not the OCX control. Thanks.


CraigHartz
 
You need to set the printer to Duplex mode. Your printing will then print duplex without you needing to do anything else. Beware though that there are two ways to print duplex, one flips the short side and the other the long side.
 
So there's no way to do it programmatically? The printer is used for other jobs besides this report and the users won't want to set it to duplex permanently.


CraigHartz
 
I am not familiar with the Crystal DLL, some of the software I use allows to pass the printer settings through the control, see below example:

Dim ps As PageSetup
Set ps = file.PageSetup

ps.Orientation = 1 ' 1=Portrait 2 = Landscape
ps.PrinterPaperSize = 1
ps.Duplex = 2 ' 0=Off 1=ShortSide 2=LongSide

copies = 1
collate = True
Printer = "\\Server\Printer"

file.Print , copies, collate, Printer,
 
It's been a while since I messed with CR, but I remember seeing somewhere in the help file how to set up the print file. If memory serves it was PrinterDuplex property set to true.
 
All right! That did it. Now printing double-sided.

Question though -- if someone tries to print to a printer that doesn't support duplex, what will happen?


CraigHartz
 
Add to the listbox all available priters.
Code:
Dim p As Printer
For Each p In Printers
  List1.AddItem p.DeviceName
Next

See if the selected printer supports Duplex
Code:
Dim i as Integer
i = list1.ListIndex

If i <> -1 then
  Set Printer = Printers(i)   ' Select that printer
  MsgBox Printer.Duplex    ' See AlexIT's post
End If

 
Thanks TipGiver

Actually I tested it before I left for the day on Friday, if the printer doesn't support full duplex it still prints single-sided anyway. So no further changes need to be made.


CraigHartz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top