1. Albert John
  2. PowerBuilder
  3. Thursday, 25 November 2021 13:38 PM UTC

im trying to print image within powerbuilder, it printed the image,but it's NOT my expected,I expected print the image just fitted a A4 paper,i expected it has at least 90% of A4 but it actually printed picture just occupied like 1/2 or 1/3 of a A4 paper,not even 80%,the pic was really too small in a A4 paper

Please take a look at my code

 

I tried to dynamically create a datawindow which attached my pic

//ll_heights is the height of that pic

//ll_widths is the width of that pic

//ls_jpgsnames is the location of that pic

 

 

 long ll_therow
             string str_dwsyntax,str_lag
            
             str_dwsyntax=dw_5.object.datawindow.syntax
             for ll_i=1 to ll_jpgscounts
                  string ls_AddPict
                    dw_5.create(str_dwsyntax)
                    dw_5.settransobject(sqlca)
                    dw_5.reset()
                    dw_5.Modify("DataWindow.header.height='" + String(ll_heights[ll_i])+"'  width='"+string(ll_widths[ll_i])+"'")
                   ls_AddPict ='CREATE bitmap(band=header  x="1" y="1" height="'+string(ll_heights[ll_i])+ '"'+&
                    ' width="' +string(ll_widths[ll_i])+'" filename="'+ ls_jpgsnames[ll_i]+'"  name=logo "))'
               dw_5.Modify(ls_AddPict)
                  dw_5.print()
                    ll_therow=dw_results.rowcount() - ll_jpgscounts +ll_i
                   wf_modifyresult(list_no_t,ls_prodno, ls_batchno,ll_jpgscounts,ls_jpgsnames[ll_i],"printed sucessful",ll_therow)
               next
                
                 dw_5.create(str_dwsyntax)
                 dw_5.settransobject(sqlca)
                 dw_5.print()

btw all pics were scanned from  A4 size papers

Any helps or any suggestions would be apperciated

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 25 November 2021 15:26 PM UTC
  2. PowerBuilder
  3. # 1

What values do you have in 

//ll_heights is the height of that pic

//ll_widths is the width of that pic

Are these in powerbuilderUnits or pixels?

 

Comment
  1. Albert John
  2. Thursday, 25 November 2021 20:58 PM UTC
Coz I have some code which determine the height and width of picture , but I didn’t show it coz I write it in c++
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 26 November 2021 00:47 AM UTC
Ok, so or starters. If your dimensions are in pixels, you could try to do some kind of a Modify() to change the datawindow to use pixels instead of powerbuilder units:

dw_5.Modify("Datawindow.Units=1") // pixels

But regretfully the "Datawindow.Units" seems to be only working for Describe(). Probably you would have to indicate it in the syntax of the "create" of the datawindow.

Easier though, is to just convert your pixels to units:

Have a look at the "PixelsToUnits PowerScript function", use XPixelsToUnits! to calculate the ll_widths expressed in pb units and YPixelsToUnits! to calculate the ll_heights, expressed in pb units.



  1. Helpful
  1. Albert John
  2. Friday, 26 November 2021 02:25 AM UTC
I apperciate you sir, i think I should print it in C++ way, this might be easier than Powerbuilder way
  1. Helpful
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.