From: Alain A. <ala...@wa...> - 2015-07-30 14:48:35
|
Le 30/07/2015 14:44, Alexander S.Kresin a écrit : > Alain Aupeix пишет: >> Hi, >> >> I have tried now with name parameters, and I have a problem with size. >> Having a look to the differences, I see that line: >> >> without name //job,589.00,836.00,2.83,2.83,utf8 >> with name //job,794.09,1122.24,3.78,3.78,utf8 >> >> I suppose it's was the paper size, but it seems not. > The first two are width and height in pixels, the next two - a > coefficient ( pixels/mm ) for this print area. So, in both lines values > are the almost same, some difference is due to rounding. Humm ... Have a look to the differences between the two reports I preview with INIT PRINTER oPrinter (sizes of the printer) and INIT PRINTER oPrinter name cprinter (where cprinter=.buffer, and where the sizes are perhaps unknown ?) Here is the skeleton of myfunction : // ============================================================================ Function CreateScript(ptype) // ============================================================================ Local oPrinter, oFont, cprinter, cTemp, cScript oStatus:SetText(" Création d'un script d'impression ...") cprinter=".buffer" cScript=ptype+".scr" //INIT PRINTER oPrinter INIT PRINTER oPrinter name cprinter //without name //job,589.00,836.00,2.83,2.83,utf8 //with name //job,794.09,1122.24,3.78,3.78,utf8 oPrinter:StartDoc(.f.,cScript) oFont := oPrinter:AddFont( "sans",6 ) oPrinter:StartPage() oPrinter:SetFont( oFont ) qout(oprinter:nWidth) qout(oprinter:nHeight) do case case ptype == "Partner" oPrinter:Box( 5,5,oPrinter:nWidth-5,oPrinter:nHeight-5 ) oPrinter:Say( "[[progname]] v[[progvers]] (c)[[progdate]] Alain Aupeix", 30,10,165,26,DT_CENTER,oFont ) oPrinter:Line( 25,25,175,25 ) oPrinter:Line( 25,5,25,25 ) oPrinter:Line( 175,5,175,25 ) oPrinter:Say( "----------", 50,120,150,132,DT_CENTER ) endcase oPrinter:Box( 50,134,160,146 ) oFont := oPrinter:AddFont( "sans",8 ) oPrinter:Say( "End Of Report", 50,135,160,146,DT_CENTER ) oPrinter:EndPage() oPrinter:EndDoc(cscript) oPrinter:End() // Set datas cTemp=memoread(cScript) cTemp="script,"+pType+","+dtoc(date())+","+left(time(),5)+","+trim(sUser)+"@"+trim(sMachine)+chr(10)+cTemp cTemp=strtran(cTemp,"[[progname]]",progname) cTemp=strtran(cTemp,"[[progvers]]",progvers) cTemp=strtran(cTemp,"[[progdate]]",progdate) do case case ptype == "Partner" cScript=trim(sUser)+"@"+trim(sMachine)+".out" endcase memowrit(cScript,cTemp,.f.) oStatus:SetText("") Return Nil ============================================================================ Values with name : qout(oprinter:nWidth) // returns 210 qout(oprinter:nHeight) // returns 297 Values without name : qout(oprinter:nWidth) // returns 208 qout(oprinter:nHeight) // returns 295 Don't know if it's the problem, but it bugs me a little ... Thanks A+ -- ------------------------------------------------------------------------ Alain Aupeix http://jujuland.pagesperso-orange.fr/ http://pissobi-lacassagne.pagesperso-orange.fr/ ------------------------------------------------------------------------ U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2015-07-27 23:39) | HbIDE (Rev.316) | Five.Linux (r143) | Hw.Gui (2474) ------------------------------------------------------------------------ |