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
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.