Sheet Menu Print is printing application background

Symptom

  • Initiating an active sheet print (ctrl+p) incorrectly prints the application background.

  • The behavior only occurs with certain printer drivers to networked Shap printers (e.g. MX-4101)

Environment

  • PowerBuilder

  • Windows 7 x64

Reproducing the Issue

Steps to reproduce issue:

  1. Download ctrlp.zip, Print_OK.pdf, Print_Not_OK.pdf.

  2. Unzip ctrlp.zip into a local directory.

  3. Open genapp.pbw workspace in PB.

  4. Click on menu entry File > Printer Setup.

  5. Select a networked Sharp printer (The SHARP MX-4101 printer was used in our testing.)

  6. Click on menu entry Run > Run genapp.

  7. Once the application is running, click on File > New… > Untitled for Sheet 1.

  8. Click on menu entry File > Print… Ctrl+P which invokes the following PowerScript:

    //*-----------------------------------------------------------------*/
    //*-----------------------------------------------------------------*/
    //*    ue_print:   Print the Active Sheet
    //*-----------------------------------------------------------------*/
    long ll_job
    w_genapp_basesheetlw_sheet
    lw_sheet = this.GetActiveSheet ( )
    If IsValid ( lw_sheet ) Then
     this.SetMicroHelp ( "Printing active sheet..." )
     ll_job = PrintOpen ( )
     lw_sheet.Print( ll_job, 1, 1 )
     PrintClose ( ll_job )
     this.SetMicroHelp ( "" )
    End If
    Return 1
  9. Expected behavior is to print the active sheet (See Print_OK.pdf).

  10. Using the networked Sharp printer causes the background to be printed (See Print_Not_OK.pdf) on Windows 7 but works properly on Windows XP.

Cause

The root cause was determined to be the standard Sharp MX-4104 PCL printer driver.

Solution

If we modified the printer driver to the Sharp universal driver, it resolved the issue.