Duplex printing w no printer selected?

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Duplex printing w no printer selected?

Postby Patrick » Thu Apr 16, 2009 11:34 pm

Greetings,

If I understand the manuals correctly, I cannot use: "#VPE.DevDuplex := 2" until I have set the device: "#VPE.Device := #gb_printr" - is this correct?

If so, How can I set duplex printing (which I need to control odd and even pages/breaks) before the user clicks on the printer icon in the VPE preview?

To clarify:
I have a check box for duplex printing. If checked, I need to add an extra page in between students if last student's page was an odd page. Then when user clicks the printer icon, all pages are already formatted correctly.

Thank you very much,
Pat
Patrick
 
Posts: 23
Joined: Thu Mar 12, 2009 5:44 pm

Postby IDEAL Software Support » Fri Apr 17, 2009 8:52 am

I don't know what "#VPE.Device := #gb_printr" exactly means in your programming language, but I assume it means "selected a printer".

Well, first of all all, you can only set the Duplex Mode for printers which support duplex printing. Otherwise the command is without effect.

Second, when you select a different printer, its default settings are initialized. So you are right: after selecting a different printer device, you must set the Duplex Mode again.

How can I set duplex printing (which I need to control odd and even pages/breaks) before the user clicks on the printer icon in the VPE preview?


The easiest would be to set the Duplex Mode after you specify the device.

Example:
Code: Select all
Vpe.OpenDoc
Vpe.Device = "Printer Xyz"
Vpe.DevDuplex = VDUP_VERTICAL


If you wish to specify the Duplex Mode immediately when the user clicks onto the print-button in the VPE Preview window, you can handle the event RequestPrint(), which is sent by VPE after the user clicked onto the print button - and it is sent during different stages of the printer setup process.

In you case you should handle the RequestPrint() event either for PRINT_MSG_SETUPSTART, which allows you to pre-initialize device properties (like the Duplex Mode) before the printer setup dialog is shown.

Or - if you want to assure that the user does not deselect the Duplex Mode - handle PRINT_MSG_SETUPEND, which is sent after the printer setup dialog has been closed.

More details about events and the RequestPrint() event can be found in the help files.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Thank you for your reply.

Postby Patrick » Fri Apr 17, 2009 5:22 pm

After adding the event: RequestPrint(), it still does not duplex!? If I use the same program and hard code a printer device, it duplexes just fine on the same printer:

IE
#VPE.Device = Prt09
#VPE.DevDuplex = VDUP_VERTICAL
INVOKE METHOD(#VPE.Preview)

This duplexes great in my initialize routine.

But trying to make it dynamic (by selecting any printer), this is how I'm trying to do it:

In the Event Handler: #VPE.RequestPrint
I handle Action 5 - PRINT_MSG_SETUPEND
I set duplex on: #vpe.DevDuplex = 2

I show the correct printer is selected, yet no duplexing happens? :(

I set the ResultingAction parameter to 0, but this should not effect the duplexing part?

What am I not doing right?

Thank you very much,
Pat
Patrick
 
Posts: 23
Joined: Thu Mar 12, 2009 5:44 pm

Postby IDEAL Software Support » Fri Apr 17, 2009 7:17 pm

What version of VPE are you using?

Are you sure your event handler is called?
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Postby Patrick » Fri Apr 17, 2009 11:32 pm

Just installed 5.0 professional. Have not updated to a new update released days ago tho.

In the RequestPrint event, I display the #vpe.Device and it always has the correct printer that I selected on the printer setup dialog box. So yes, the event is being handled.

I do call #vpe.DevDuplex twice before printing. Can I call this property more than once before printing starts?

Thank you,
Pat
Patrick
 
Posts: 23
Joined: Thu Mar 12, 2009 5:44 pm

Postby IDEAL Software Support » Mon Apr 20, 2009 10:17 am

Setting the Duplex Mode definitely works. Maybe you have no access permissions on your system to modify the printer properties?

For testing purposes, set DevDuplex for PRINT_MSG_SETUPSTART. Does the printer dialog then show that the duplex mode is activated?

I do not understand your programming language, what language are you using?

In Visual Basic 6.0, using the VPE ActiveX, the code is:
Code: Select all
Private Sub Form_Load()
   VPE1.OpenDoc
   VPE1.Preview
End Sub

Private Sub VPE1_RequestPrint(ByVal Action As Long, ResultingAction As Long)
   If Action = PRINT_MSG_SETUPSTART Or Action = PRINT_MSG_SETUPEND Then
      VPE1.DevDuplex = VDUP_VERTICAL
   End If
   ResultingAction = PRINT_ACTION_OK
End Sub
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Sorry for the late reply

Postby Patrick » Mon Jun 29, 2009 4:23 pm

I can duplex in my intitialize routine just fine - so no permision problems, printer does duplex....

Setting #VPE.RequestPrint to trap PRINT_MSG_SETUPSTART (value 4), it shows my default printer (Prt05) and Devduplex = 2 (that I just set).
I select a different printer and trap PRINT_MSG_SETUPEND (value 5), It shows the printer I selected (Prt09) and DevDuplex = 2.

It always prints on 2 pieces of paper tho? When I have my dialog boxes open during the PRINT_MSG_SETUPEND event, I see the VPE printer status bar (the one it shows when spooling the file to Windows) and it shows 1 of the 2 pages has already printed? So it seems like I do not have time enough to set this property before VPE prints? Dang, VPE is quick! LOL

I use Visual Lansa programming environment - It's like Visual Basic in many ways. If it helps - the code I'm using is:



EVTROUTINE HANDLING(#VPE.RequestPrint) ACTION(#this_action) RESULTINGACTION(#this_zero)

* Set duplex mode here if duplex is selected

* Automatically set resulting action to 0 (proceed)
#this_zero := 0


IF ('#this_action.value = 5') * 5 = printer dialog closed (User selected a printer)
IF ('#gbduplex = Y') * User checked duplex check box

#vpe.DevDuplex := 2

* Show what the user selected (DEBUG ONLY)
USE BUILTIN(MESSAGE_BOX_ADD) WITH_ARGS('#VPE.Device: ' #VPE.Device)
USE BUILTIN(MESSAGE_BOX_ADD) WITH_ARGS('#VPE.DevDuplex: ' #vpe.DevDuplex)
USE BUILTIN(MESSAGE_BOX_SHOW) WITH_ARGS(OK OK INFORMATION Duplex_On)

ENDIF
ENDIF




IF ('#this_action.value = 4') * 4 = printer dialog opened
IF ('#gbduplex = Y')

#vpe.DevDuplex := 2

USE BUILTIN(MESSAGE_BOX_ADD) WITH_ARGS('#VPE.Device4: ' #VPE.Device)
USE BUILTIN(MESSAGE_BOX_ADD) WITH_ARGS('#VPE.DevDuplex4: ' #vpe.DevDuplex)
USE BUILTIN(MESSAGE_BOX_SHOW) WITH_ARGS(OK OK INFORMATION Duplex_On4)
ENDIF
ENDIF



ENDROUTINE



Any other suggestions?

Thank you very much,
Pat
Patrick
 
Posts: 23
Joined: Thu Mar 12, 2009 5:44 pm

Postby IDEAL Software Support » Tue Jun 30, 2009 9:21 am

I didn't look at your source code. The language looks ugly.

If DevDuplex is set, but the printer does not print duplex, it either can not print duplex, or the printer driver has a bug. Try finding a compatible or newer printer driver. Another cause for the problem might be that you are printing unsorted copies, e.g. five times page 1, five times page 2, etc. which - by logic - can not be duplexed.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 0 guests

cron