1. Oebrown Cheng
  2. PowerBuilder
  3. Wednesday, 19 May 2021 02:00 AM UTC

I have two printer with different paper size (A4 & small label)

i use below script, choose printer then print out, it always print out the default printer paper size.
dw_1.print(true,true)

after search and known that PB's printer session,
i change to below script, it work fine and print out correct paper size when choose different printer.
PrintSetup()
dw_1.Print(true, false)

but i don't see any window to set pager range to print, only can print all pages.
Dose any solution to set page range to print ?

(I use PB2019 R3 build 2703 on Win10 20H2)

thanks

 

Accepted Answer
Oebrown Cheng Accepted Answer Pending Moderation
  1. Wednesday, 19 May 2021 13:11 PM UTC
  2. PowerBuilder
  3. # Permalink

thank you for reply.

the print function with second parameter TRUE,
shows system printer dialog, but the printer property paper size is not bring from windows printer setting to PB.

i think it is a print function bug/issue.
i do below test, in windows 10 , two printer setting:

printer1 - "Microsoft Print to PDF" (use default A4 paper size) [set as default printer]
printer2 - "Microsoft XPS Document Writer" (assign custom 7x5cm paper size)

application run dw_1.print(true,true)
show print dialog, then choose printer2 and click "property", you can see paper size is not correct.
(print out is also not correct paper size)

yes,you can re-assign paper size in property setting, and print out correct,
but when you close window and reopen window, and run .pring(true,true),
the paper size is back to privous.

In fact, application user wouldn't re-assign paper size every time when print.
I also test it in user site, print out to real printer, also still got paper size issue.

---------------------------------
maybe i must code all datawindow print.properties as you say,
i think it is not make sense.

finally, i use below script for woraround, but can't set page range.
PrintSetup()
dw_1.Print(true, false)   //do not show system dialog

Comment
  1. Oebrown Cheng
  2. Wednesday, 19 May 2021 14:11 PM UTC
I set 0 (Default).

after testing, i set datawindow object paper size, it will not overwrite print setting.

i think not need to set datawindow object paper size, it should according to printer setting.

I use old PB version (PB7), print paper size is not the issue, the new version PB maybe have some problems.
  1. Helpful
  1. René Ullrich
  2. Thursday, 20 May 2021 05:37 AM UTC
You should open a support ticket.
  1. Helpful
  1. Oebrown Cheng
  2. Friday, 21 May 2021 03:46 AM UTC
I will reqiest a support ticket.

thank you.

  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 19 May 2021 05:44 AM UTC
  2. PowerBuilder
  3. # 1

Hi,

You may code all properties for printing like printer, page size, page range ... if you Modify Datawindow.Print properties.

https://docs.appeon.com/pb2019r2/datawindow_reference/ch03s03.html#XREF_91740_Print_property

 

If you use Print function with second parameter TRUE it shows a print dialog where you can select the printer and change the printer properties. It should be also possible to change the paper size in the printer properties.

In the print dialog can you usually also select the page range. Sometimes the selection is grayed out. It seems that Powerbuilder doesn't know about the number of pages in the datawindow before it first generetes the print layout. If you try to print the report first time you can't specify the page range. If you try again it works.

I don't know if this is a bug. As workaround you can change the datawindow in print preview mode before you start to print. It's enough to do it for a short time.

e.g.

dw_1.object.datawindow.print.preview = true
dw_1.object.datawindow.print.preview = false
li_rc = dw_1.Print (true, true)

 

HTH,

René

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.