Duplex

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Duplex

Postby Frigyes » Wed Jul 03, 2013 10:16 pm

Hello again...

now I have (little) troubles with duplex printing,

I have 2 printers, one Brother with duplex and one HP without,

if my standard printer is the Brother (with Duplex) I can do anything switch on/off duplex works all as accepted,

but if my standard printer is the HP and I change it with the PrintDialog to Brother,
no chance to change the duplex setting, the Printer use allways the orig. setting

any Idea?

Regards
Frigyes
Frigyes
 
Posts: 26
Joined: Thu Jun 29, 2006 12:09 pm

Re: Duplex

Postby IDEAL Software Support » Fri Jul 05, 2013 9:58 am

What are you doing to change the duplex setting? Are you displaying the Printer Setup Dialog and try to change the setting with the mouse, or are you trying it by code? If you do try by code, please post the source code. What Windows version (version and x86 or x64?) and Service Pack are you using?
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Duplex

Postby Frigyes » Fri Jul 05, 2013 12:47 pm

Hallo!

this is my testcode:

Code: Select all
int myDuptest()
  {
    hDoc = VpeOpenDoc(hMainWindow, "Test", VPE_EMBEDDED + VPE_NO_RULERS  + VPE_FIXED_MESSAGES );
    // Open DOC and set  VpeDevice to standard printer, (my standard printer has no duplex)
   
    VpeSetPrintOptions(hDoc, PRINT_ALL + PRINT_NO_AUTO_PAGE_DIMS);
    // I try with and without this, the same
   
    myDuplex = VDUP_VERTICAL; // myDuplex is a global int variable
   
    VpeGetDevice(hDoc,mMsg,64);
    VpePrint(hDoc, 1 , 2, mMsg);
    sprintf(mMsg, "Duplex: %d\n",VpeGetDevDuplex(hDoc));
    VpePrint(hDoc, 1 , 4, mMsg);
    VpePageBreak(hDoc);
    VpePrint(hDoc, 1 , 4, "[ S 24 ]Page ... 2");
    VpePreviewDoc(hDoc, NULL , VPE_SHOW_MAXIMIZED);
   
    VpePrintDoc(hDoc,1); 
    // Print with Dialog, now I can change to my duplex Printer
    // but the output is simple



and this is in windproc:
Code: Select all

 case VPE_PRINT:
     switch (wParam)
     {
       case PRINT_MSG_SETUPABORT:  // User aborted Setup-Dialog
            break;
       case PRINT_MSG_SETUPSTART:  // Setup-Dialog started
            VpeSetDevDuplex(hDoc, myDuplex );
            break;
       case PRINT_MSG_SETUPEND:    // Setup-Dialog ended
            VpeSetDevDuplex(hDoc, myDuplex);
            break;
       case PRINT_MSG_START:
            break;
     }
    return 0;

   


no chance to print in duplex when the standard printer simplex,

if the standard printer duplex, or I set it with a .prs file to duplex printer, works fine

OS Windows7 Prof, 32 Bit, VPE 6.1 Prof.

TIA
Regards
Frigyes
Frigyes
 
Posts: 26
Joined: Thu Jun 29, 2006 12:09 pm

Re: Duplex

Postby IDEAL Software Support » Fri Jul 05, 2013 4:21 pm

The PRINT_MSG_SETUPSTART event is fired, just before the printer setup dialog is shown. Therefore it means you are trying to set duplex for the currently selected simplex printer. This can not work.

Calling VpeSetDevDuplex() in PRINT_MSG_SETUPEND should work. Maybe the printer driver does not accept VDUP_VERTICAL and you need to specify VDUP_HORIZONTAL.

Are you sure your event handler is executed? Best you set a break-point there in the debugger.

Please check the return code of VpeSetDevDuplex() for each call and post the results here.

Please do also post what VpeGetDevice() returns in PRINT_MSG_SETUPEND.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Duplex

Postby Frigyes » Sat Jul 06, 2013 2:42 pm

Thank you for the answer.

first,
set duplex in PRINT_MSG_SETUPEND event, definitely not works, can't change duplex (I try it many times)

if I set duplex in PRINT_MSG_SETUPSTART event, my printer works with VDUP_VERTICAL or VDUP_HORIZONTAL
but only when the Print-Dialog starts with a Duplex-Printer

anything else works, VpeSetDevDuplex() never returns false, the VpeGetDevice() returns the selected printer

I insert my test in your VpeDemo source ( only changed the color_table() proc. and the dupl. setting in windproc)
Code: Select all
void color_table()
{
      TCHAR mMsg[255];
      VpeHandle  hDoc = VpeOpenDoc(hMainWindow, "Test", VPE_NO_PAGESCROLLER );
      // Open DOC and set  VpeDevice to standard printer, (my standard printer has no duplex)
   
     VpeSetPrintOptions(hDoc, PRINT_ALL + PRINT_NO_AUTO_PAGE_DIMS);
     // I try with and without this, the same

     myDuplex = VDUP_VERTICAL; // myDuplex is a global int variable

      VpeGetDevice(hDoc,mMsg,64);
       VpePrint(hDoc, 1 , 2, mMsg);
     sprintf(mMsg, "Duplex: %d\n",VpeGetDevDuplex(hDoc));
     VpePrint(hDoc, 1 , 4, mMsg);
         VpePageBreak(hDoc);
       VpePrint(hDoc, 1 , 4, "[ S 24 ]Page ... 2");
      VpePreviewDoc(hDoc, NULL , VPE_SHOW_MAXIMIZED);

     VpePrintDoc(hDoc,1); 
     // Print with Dialog, now I can change to my duplex Printer
     // but the output is simple
};

// the event-handler
    case VPE_PRINT:
       switch (wParam)
       {
        case PRINT_MSG_SETUPABORT:  // User aborted Setup-Dialog
         //  Msg("Caught event from VPE: Setup aborted.");
           break;
           
        case PRINT_MSG_SETUPSTART: // Setup-Dialog started
        if ( !(VpeSetDevDuplex((VpeHandle)lParam, myDuplex)))  Msg("duplex set false (in SETUPSTART)");
           break;
           
        case PRINT_MSG_SETUPEND:   // Setup-Dialog ended
          if (!(VpeSetDevDuplex((VpeHandle)lParam, myDuplex)))  Msg("duplex set false (in SETUPEND)");

           break;
           
        case PRINT_MSG_START:
          if (!(VpeSetDevDuplex((VpeHandle)lParam, myDuplex)) )  Msg("duplex set false (in START)");
           break;





with the same result,

I try this also on my Win8 Laptop the same...

the Printer is Brother MFC-7460DN

Regards
Frigyes
 
Posts: 26
Joined: Thu Jun 29, 2006 12:09 pm

Re: Duplex

Postby IDEAL Software Support » Tue Jul 09, 2013 6:51 am

We will test this. We will post the results here in a few days.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Duplex

Postby IDEAL Software Support » Fri Jul 12, 2013 8:55 am

Here are our test results:

1) VpeSetDevDuplex(hDoc, VDUP_VERTICAL) returns false for our simplex printer and true for our duplex printer. If it returns true for your simplex printer, the printer driver has a bug.

2) When receiving the event PRINT_MSG_SETUPEND, device control properties can not be changed. We updated VPE, so the next release will allow to do so. Here is the log-message from our version control system: "The event PRINT_MSG_SETUPEND was sent via Win API PostMessage. Therefore any device control properties (like e.g. DevDuplex) could not be changed at that point in time (the print job had already started, but the message is received by the application at a later point in time). Changed now to SendMessage(), so Device Control Properties can be changed at that stage of the printing process. However, this is dangerous, because the user can call in the event handler VPE methods that might crash the application, e.g. CloseDoc(). It is left to the responsibility of the user that he/she does not misuse the event."
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Duplex

Postby Frigyes » Sun Jul 14, 2013 3:57 pm

Hallo!

to 1,
If I print on simplex Lexmark C500 setduplex returns false
but on simplex HP Laserjet P2015, setduplex returns true,
on the duplex printer returns also true

I do it hard to imagine that HP makes bad driver, I try this still with different environment

to 2,
OK I understand ...

Thx

Regards
Frigyes
Frigyes
 
Posts: 26
Joined: Thu Jun 29, 2006 12:09 pm

Re: Duplex

Postby IDEAL Software Support » Mon Jul 15, 2013 9:46 am

HP had released many faulty drivers especially in the 1990s. Some drivers even caused crashes. VPE contains several workarounds especially because of bugs in HP drivers. So for us it is not surprising. Or how else would you explain that VpeSetDevDuplex() returns correct values for other drivers? Do you think, just because they are a huge company, they make better code than we do?

To be exact: VPE writes the duplex value to the printer-driver, and then reads the value back from the driver, in order to check whether it *really* is accepted by the driver. So, if the simplex driver accepts this value, it is the fault of the driver.
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 14 guests

cron