1. Erick Bergsma
  2. PowerBuilder
  3. Thursday, 8 September 2022 15:57 PM UTC

Hello PB Guru's...

Since putting in R3 1915, we have come across an issue where the This.Print(JobNo, X, Y) no longer captures the screen.

If I set my printer to  PDF printer, the file captures is 1 KB and is blank.

If I set it to a real printer, a blank page is printed.

On a Test box, we reverted to the 1880 RunTimes, and it works as expected.

 

I see there was a Bug Fix in 1915...

Bug ID: 3248(2017 R3 JP)

 

Any chance this had something to do with it??

 

Any ideas or help would be appreciated...

 

Erick Bergsma Accepted Answer Pending Moderation
  1. Tuesday, 13 September 2022 12:43 PM UTC
  2. PowerBuilder
  3. # 1

As an update,,,

I installed PB 2019 R3 Build 2779.

Migrated a copy of my code.

Tested the app and the .Print functionality worked as it always has.

Something in latest 2017 Builds has caused it to stop working, but is fixed in 2019.

 

 

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 9 September 2022 11:11 AM UTC
  2. PowerBuilder
  3. # 2

I believe that with PB 2017 Build 1951, I can switch my license so that I can run PB 2017 and PB 2019.

That's true. With 1951 you can use concurrently PB 2017 with any other newer version (same user on the same pc).

At home, I still have an installation of PB 2017. I will test it also there. Are you using PFC's? Or you simply have inheritance?

Andreas.

Comment
  1. Andreas Mykonios
  2. Friday, 9 September 2022 11:43 AM UTC
Ok. I will do some tests later, and if you haven't a solution until then I will post my findings (if any).

Andreas.
  1. Helpful
  1. Andreas Mykonios
  2. Sunday, 11 September 2022 17:53 PM UTC
Sorry for answering so late.

I did tested the same code in PB 2017 R3. I used a pfc application (which has many levels of inheritance). Print command was successful.

Using PB 2019 R3 1951. But I don't believe that the ebf may drive to a different result as it doesn't contain a related fix (https://www.appeon.com/standardsupport/bugfixes?contents=&product=PowerBuilder&category=&version=2017+R3&build=1951).

Andreas.
  1. Helpful
  1. Andreas Mykonios
  2. Sunday, 11 September 2022 17:54 PM UTC
I am using Windows 10.
  1. Helpful
There are no comments made yet.
Erick Bergsma Accepted Answer Pending Moderation
  1. Friday, 9 September 2022 11:04 AM UTC
  2. PowerBuilder
  3. # 3

Thank you Andreas!!

We are considering the move to PB 2019 once our move to Oracle 19 is complete.

I will add one ,ore piece of testing... 

If I do the .Print command where just the ancestor window is being displayed, I get the screen shot.

However, if there is a window that has been opened, it does not take the screen shot.

If I set my printer to a PDF printer, the first PDF is 43 KB in size, the next one is 1 KB.

 

I believe that with PB 2017 Build 1951, I can switch my license so that I can run PB 2017 and PB 2019.

 

I might try your version to see if it addresses my issue, and to see how complex the migration from PB 2017 to PB 2019 might be.

 

Thanks again!!

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 9 September 2022 09:02 AM UTC
  2. PowerBuilder
  3. # 4

Hi.

I did tested the following code on a window:

long Job

Job = PrintOpen( )
Print(Job, "Report of Year-to-Date Sales")
w_my_window.Print(Job, 1000,PrintY(Job)+500, 6000,4500)
PrintPage(Job)
parent.Print(Job, 1000,PrintY(Job)+500, 6000,4500)
PrintClose(Job)

w_my_window is my window, and there is a command button that contains the above script.

When I click the button it prints the window twice (one for w_my_window.Print and one parent.Print call).

I'm using PB 2019 R3 2779. Cannot test it in PB 2017 R3. I don't use it anymore.

Andreas.

Comment
There are no comments made yet.
Erick Bergsma Accepted Answer Pending Moderation
  1. Thursday, 8 September 2022 16:59 PM UTC
  2. PowerBuilder
  3. # 5

Thanks Olan...

the Help for .Print for 1915 still seems to reference what we currently do, but it's just not working...

Syntax 1: For printing a visual object in a print job

Description

Includes a visual object, such as a window or a graph control, in a print job that you have started with the PrintOpen function.

Applies to

Any object

Syntax

objectname.Print ( printjobnumber, x, y {, width, height } )

 

Argument

Description

objectname

The name of the object that you want to print. The object must either be a window or an object whose ancestor type is DragObject, which includes all the controls that you can place in a window.

printjobnumber

The number the PrintOpen function assigns to the print job.

x

An integer whose value is the x coordinate on the page of the left corner of the object, in thousandths of an inch.

y

An integer whose value is the y coordinate on the page of the left corner of the object, in thousandths of an inch.

width (optional)

An integer specifying the printed width of the object in thousandths of an inch. If omitted, PowerBuilder uses the object's original width.

height (optional)

An integer specifying the printed height of the object in thousandths of an inch. If omitted, PowerBuilder uses the object's original height.


Return value

Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, Print returns null.

 

So I'm thinking that it is still the right code to use for doing a "PrintScreen".

Would you know what PBxx170.DLL or TPxx.DLL in the Runtimes actually does this functionality?

it has been working well in all the previous releases of PB 17 that we have been using.

 

Comment
  1. Olan Knight
  2. Monday, 12 September 2022 15:32 PM UTC
Have you tried my suggested solution? If not, give it a shot.
  1. Helpful
  1. Erick Bergsma
  2. Monday, 12 September 2022 18:02 PM UTC
I get "Bad argument list for function: print"

the TRUE, TRIUE arguments don't appear to be options me me based on the Help for Print command.

Maybe this is something PFC related, which we don't use.



  1. Helpful 1
  1. Olan Knight
  2. Tuesday, 13 September 2022 16:57 PM UTC
Ah.

Yes, this is PFC related! :) Which explains why it works for me and not for you.

  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 8 September 2022 16:05 PM UTC
  2. PowerBuilder
  3. # 6

Erick -

   This changed 5 years ago when PBv10.5 was released. If you are using the PFC you need to override the CORP_U_DW.PFC_PRINTDLG event. My code is listed below; the actual CHANGE for the print dialog command is in BOLD BLUE TEXT. Check out the HELP file entry for detailed information.


//********************************************************************
// Object       :  corp_u_dw
// Event        :  pfc_PrintDlg()
//
// Ancestor     :  OVERRIDDEN
// Access       :  Public
// Arguments    :  value   s_printdlgattrib   astr_printdlg   structure by ref
//
// Returns      :  Integer
// Throws       :  None
//
// Description  :  Opens the print dialog for this DataWindow,
//                 and sets the print values the user selected for the DW.
//
//********************************************************************
// Revision History
//
// Developer    Date             Version     Description
// ---------   -----------   ---------   -------------------------------
// O Knight    28-NOV-2017   6.0.4.33    #2026345:  Implement new copyright.
//                           9.0         Fix CR156666 to enable print orientation setting.
//                           8.0         Return code of of_printdlg has changed for Cancel Action.
//                                       Changed code to test on success code.
//                           5.0         Initial version.
//
//********************************************************************
// COPYRIGHT © 2017 CSG SYSTEMS INTERNATIONAL, INC. AND/OR ITS
// AFFILIATES (“CSG”). ALL RIGHTS RESERVED.
//********************************************************************
boolean               lb_collate
integer               li_copies
long                  ll_rc
long                  ll_pagecount
string                ls_pagecount
string                ls_pathname = "Output"
string                ls_filename
string                ls_copies
string                ls_collate
n_cst_platform        lnv_platform
n_cst_conversion      lnv_conversion
window                lw_parent
string ls_orientation



// Initialize printdlg structure with current print values of DW
astr_printdlg.b_allpages = true

ls_orientation = this.object.datawindow.print.orientation
astr_printdlg.i_orientation  = integer(ls_orientation)

ls_copies = this.Object.DataWindow.Print.Copies
if not IsNumber (ls_copies) then    ls_copies = "1"

li_copies = Integer (ls_copies)
astr_printdlg.l_copies = li_copies

ls_collate = this.Object.DataWindow.Print.Collate
lb_collate = lnv_conversion.of_Boolean (ls_collate)
astr_printdlg.b_collate = lb_collate

astr_printdlg.l_frompage = 1
astr_printdlg.l_minpage = 1

ls_pagecount = this.Describe ("Evaluate ('PageCount()', 1)")
if IsNumber (ls_pagecount) then
    ll_pagecount = Long (ls_pagecount)
    astr_printdlg.l_maxpage = ll_pagecount
    astr_printdlg.l_topage = ll_pagecount
end if

if this.GetSelectedRow (0) = 0 then    astr_printdlg.b_disableselection = true

// Allow printdlg structure to have additional values
// set before opening print dialog
this.event pfc_preprintdlg (astr_printdlg)

// Open print dialog
//f_setplatform (lnv_platform, true)
//this.of_GetParentWindow (lw_parent)
//ll_rc = lnv_platform.of_PrintDlg (astr_printdlg, lw_parent)
//f_setplatform (lnv_platform, false)

ll_rc = this.Print (TRUE, TRUE)

// Set print values of DW based on users selection
if ll_rc = 1 then
    // Page Range
    if astr_printdlg.b_allpages then
        this.Object.DataWindow.Print.Page.Range = ""
    elseif astr_printdlg.b_pagenums then
        this.Object.DataWindow.Print.Page.Range = &
            String (astr_printdlg.l_frompage) + "-" + String (astr_printdlg.l_topage)
    elseif astr_printdlg.b_selection then
        this.Object.DataWindow.Print.Page.Range = "selection"
    end if

    // Collate copies
    this.Object.DataWindow.Print.Collate = astr_printdlg.b_collate

    // Number of copies
    this.Object.DataWindow.Print.Copies = astr_printdlg.l_copies

    // Fix CR156666
    // Print orientation
    this.Object.DataWindow.Print.Orientation = astr_printdlg.i_orientation

    // Print to file (must prompt user for filename first)
    if astr_printdlg.b_printtofile then
        if GetFileSaveName ("Print to File", ls_pathname, ls_filename, "prn", &
            "Printer Files,*.prn,All Files,*.*") <= 0 then
            return -1
        else
            this.Object.DataWindow.Print.Filename = ls_pathname
        end if        
    end if
end if


return ll_rc



 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.