Hi all,
I know that in order to detect the printer page size I can use oPrn:GetphySize() but is there a function to have directly the page format (example A4, A5, A3....) ?
Thanks
//------------------------------------------------------------------------------------------
Function Test()
oPrinter = PrintBegin('Test',.T.,.T.,,.T.)
msginfo( PrnGetPaper(oPrinter)[1] ) // string with constant name of printer class
msginfo( PrnGetPaper(oPrinter)[2] ) // number of parameter for PrnSetPage function
msginfo( PrnGetPaper(oPrinter)[3] ) // string with name of paper
RETURN
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
*
* PrnGetPaper
* Returns the array of information about paper of printer select
* by Yury Marcelino Al (yma) - 06/2006 - yury030575@yahoo.com.br
*
//------------------------------------------------------------------------------------------
Function PrnGetPaper( oPrn )
local aPoint := PrnGetSize( oPrn:hDc )
local aRecmm := {}
local nW := 0
local nH := 0
local wx := 0
local aPapers:={{"DMPAPER_LETTER " , 1 , "Letter " , {216,279} },;
{"DMPAPER_LETTERSMALL " , 2 , "Letter Small " , {216,279} },;
{"DMPAPER_TABLOID " , 3 , "Tabloid " , {280,432} },;
{"DMPAPER_LEDGER " , 4 , "Ledger " , {432,280} },;
{"DMPAPER_LEGAL " , 5 , "Legal " , {216,356} },;
{"DMPAPER_STATEMENT " , 6 , "Statement " , {140,216} },;
{"DMPAPER_EXECUTIVE " , 7 , "Executive " , {184,257} },;
{"DMPAPER_A3 " , 8 , "A3 " , {297,420} },;
{"DMPAPER_A4 " , 9 , "A4 " , {210,297} },;
{"DMPAPER_A4SMALL " , 10 , "A4 Small " , {210,297} },;
{"DMPAPER_A5 " , 11 , "A5 " , {148,210} },;
{"DMPAPER_B4 " , 12 , "B4 " , {250,354} },;
{"DMPAPER_B5 " , 13 , "B5 " , {182,257} },;
{"DMPAPER_FOLIO " , 14 , "Folio " , {216,330} },;
{"DMPAPER_QUARTO " , 15 , "Quarto " , {215,275} },;
{"DMPAPER_10X14 " , 16 , "10x14 in " , {254,356} },;
{"DMPAPER_11X17 " , 17 , "11x17 in " , {280,432} },;
{"DMPAPER_NOTE " , 18 , "Note " , {216,279} },;
{"DMPAPER_ENV_9 " , 19 , "Envelope #9 " , {098,225} },;
{"DMPAPER_ENV_10 " , 20 , "Envelope #10 " , {105,241} },;
{"DMPAPER_ENV_11 " , 21 , "Envelope #11 " , {114,264} },;
{"DMPAPER_ENV_12 " , 22 , "Envelope #12 " , {109,279} },;
{"DMPAPER_ENV_14 " , 23 , "Envelope #14 " , {127,292} },;
{"DMPAPER_ENV_DL " , 27 , "Envelope DL " , {110,220} },;
{"DMPAPER_ENV_C5 " , 28 , "Envelope C5 " , {162,229} },;
{"DMPAPER_ENV_C3 " , 29 , "Envelope C3 " , {324,458} },;
{"DMPAPER_ENV_C4 " , 30 , "Envelope C4 " , {229,324} },;
{"DMPAPER_ENV_C6 " , 31 , "Envelope C6 " , {114,162} },;
{"DMPAPER_ENV_C65 " , 32 , "Envelope C65 " , {114,229} },;
{"DMPAPER_ENV_B4 " , 33 , "Envelope B4 " , {250,353} },;
{"DMPAPER_ENV_B5 " , 34 , "Envelope B5 " , {176,250} },;
{"DMPAPER_ENV_B6 " , 35 , "Envelope B6 " , {176,125} },;
{"DMPAPER_ENV_ITALY " , 36 , "Envelope " , {110,230} },;
{"DMPAPER_ENV_MONARCH " , 37 , "Envelope Monarch " , {098,191} },;
{"DMPAPER_ENV_PERSONAL " , 38 , "6 3/4 Envelope " , {092,165} },;
{"DMPAPER_FANFOLD_US " , 39 , "US Std Fanfold " , {378,279} },;
{"DMPAPER_FANFOLD_STD_GERMAN" , 40 , "German Std Fanfold " , {216,305} },;
{"DMPAPER_FANFOLD_LGL_GERMAN" , 41 , "German Legal Fanfold" , {216,330} } }
aRecmm = oPrn:Pix2Mmtr(aPoint[1], aPoint[2])
nW = ROUND(aRecmm[1],0)
nH = ROUND(aRecmm[2],0)
for wx=1 to len(aPapers)
if aPapers[wx,4,1] = nW .AND. aPapers[wx,4,2] = nH
return {aPapers[wx,1],aPapers[wx,2],aPapers[wx,3]}
endif
next
return {"",0,""}
//------------------------------------------------------------------------------------------
regards
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 36 guests