Could anyone show me how to interrogate the printer (or driver, I suppose) to return the size of paper currently in the printer, eg, Letter or A4? I think you could use a DEVMODE struct, but I will be honest, and say I don't know how to do it! I think Letter size would return 1, and A4 would be 15
I don't know if this may help (or not), but here is a library written in C and compiled with LCC.
More than 200 functions, documentation included and there's a working example written for PowerBAsic (i guess).
See attached zip archive.
I will take a look at that, thank you
And AstroGrep looks very useful. I have just downloaded it now
Well, I made a start on the printer DLL. Then I got stuck on the CopyMemory call. Too complicated for my tiny brain! Any ideas?
I found this as part of gdi+ for the vb.NET version but I couldn't find anything like it in the version we're using. Maybe someone who knows more will have better luck.
I've been searching and it seems they always mention GetDeviceCaps, here it is an example, it looks easy to translate. No idea if is this what you are looking for.
ResolutionWidth& = GetDeviceCaps(Printer_hDC&, %LOGPIXELSX)
ResolutionHeight& = GetDeviceCaps(Printer_hDC&, %LOGPIXELSY)
pixelsLeftMargin& =GetDeviceCaps(Printer_hDC, %PHYSICALOFFSETX)
pixelsTopMargin& =GetDeviceCaps(Printer_hDC, %PHYSICALOFFSETY)
pixelsPrintWidth& = GetDeviceCaps(Printer_hDC&, %HORZRES)
pixelsPrintHeight& = GetDeviceCaps(Printer_hDC&, %VERTRES)
pixelsPhysicalWidth& = GetDeviceCaps(Printer_hDC, %PHYSICALWIDTH)
pixelsPhysicalHeight& = GetDeviceCaps(Printer_hDC, %PHYSICALHEIGHT)
PhysicalPaperWidthInch@ = pixelsPhysicalWidth&/ResolutionWidth&
PhysicalPaperHeightInch@ = pixelsPhysicalHeight&/ResolutionHeight&
LeftMarginInch@ = pixelsLeftMargin&/ResolutionWidth&
RightMarginInch@ = (pixelsPhysicalWidth& - pixelsPrintWidth& - pixelsLeftMargin&)/ResolutionWidth&
TopMarginInch@ = pixelsTopMargin&/ResolutionHeight&
BottomMarginInch@ = (pixelsPhysicalHeight& - pixelsPrintHeight& - pixelsTopMargin&)/ResolutionHeight&
PD: AstroGrep looks very useful, indeed. I still have to try Andy's program.
I've got some of those calcs in my print preview code in the IWB IDE!
My brain hasn't been working too well here lately.
Hi every one.
This is how to do it easily, as I have said before, the registry holds many things in it.
Attached is the program.
All printers are in the registry key...
Most printers (physical or software) have a sub folder called "DsDriver".
In the "DsDriver" sub key there is an entry called "printMediaReady".
"printMediaReady" has the default paper size value.
The command GETDEFAULTPRINTER looks at the key...
In here the default printer is listed with some other things as well, on my PC the entry "Device" has this...
HP DJ 2130 series,winspool,Ne02: (my printer - HP DJ 2130 series - before the first comma)
Larry, it happens to me all the time. Also, I take a break from time to time, and when I come back I have no idea what I was doing ^^ Andy, I don't have a printer but I can spot printMediaReady as you stated inside 'Microsoft Print to PDF' with a value of "A4".
Yes even most "software" printers will have an entry.