Ok
using the code below I am simply trying to print a 1mm thick box 10mm in from the edge of the paper.
Code: Select all
Global HDPmm.d,VDPmm.d
Global PWidth,PHeight,PUsableWidth,PUsableHeight,PTopMargin,PLeftMargin,PBottomMargin,PRightMargin
;Change these for the paper size in your printer
;These are for A4
Define PageWidth.i = 210
Define PageHeight.i = 297
Procedure GetPrinterInfo()
printer_DC.l = StartDrawing(PrinterOutput())
If printer_DC
HDPmm = GetDeviceCaps_(printer_DC,#LOGPIXELSX) / 25.4
VDPmm = GetDeviceCaps_(printer_DC,#LOGPIXELSY) / 25.4
PWidth = GetDeviceCaps_(printer_DC,#PHYSICALWIDTH) / HDPmm
PHeight = GetDeviceCaps_(printer_DC,#PHYSICALHEIGHT) / VDPmm
PUsableWidth = GetDeviceCaps_(printer_DC,#HORZSIZE) ; Returns mm
PUsableHeight = GetDeviceCaps_(printer_DC,#VERTSIZE); Returns mm
PTopMargin = GetDeviceCaps_(printer_DC,#PHYSICALOFFSETY) / VDPmm
PLeftMargin = GetDeviceCaps_(printer_DC,#PHYSICALOFFSETX) / HDPmm
PBottomMargin = PHeight - PUsableHeight - PTopMargin
PRightMargin = PWidth - PUsableWidth - PLeftMargin
EndIf
StopDrawing()
EndProcedure
If PrintRequester()
StartPrinting("Test")
GetPrinterInfo()
StartVectorDrawing(PrinterVectorOutput(#PB_Unit_Millimeter))
Debug "HDPI " + Str(HDPmm)
Debug "VDPI " + Str(VDPmm)
Debug "Vector W " + Str(VectorOutputWidth())
Debug "Vector H " + Str(VectorOutputHeight())
Debug "Page Width " + Str(PWidth)
Debug "Page Height " + Str(PHeight)
Debug "Usable Width " + Str(PUsableWidth)
Debug "Usable Height " + Str(PUsableHeight)
Debug "Top Margin " + Str(PTopMargin)
Debug "Left Margin " + Str(PLeftMargin)
Debug "Bottom Margin " + Str(PBottomMargin)
Debug "Right Margin " + Str(PRightMargin)
;Draw a box 10mm from the edges of the page
AddPathBox(10 - PLeftMargin, 10 - PTopMargin, PageWidth - 20, PageHeight - 20)
StrokePath(1)
StopVectorDrawing()
StopPrinting()
EndIf
Running this on Windows I get a 1mm thick box 10mm from the edges whether I select borderless or not
Running this on the MAC without selecting borderless I get two sides of the box the left and right both 10mm from the edge of the paper. The Top and Bottom of the box is missing.
Selecting the borderless paper type I get a smaller box, not 10mm from each edge, but it is all drawn.
Creating my own paper type with no borders\margins gives me the same as if I did not select borderless.
However when creating my own paper type I selected my printer and the minimum margins for the top and bottom are shown as 12.7mm? The left and right are shown as 3.18mm which is very close. This would explain why the Top and bottom are cut off
These margins are wrong for this printer it imposes a 3mm margin all round so to me it seems like a bug in the driver for the printer on the MAC as these are gathered from the driver somehow I assume.
I was then getting curious so I changed the box to print 15mm from each edge and it worked. A nice box 15mm from each edge.
Need to do some more testing but from that it maybe that I am wrong about the MAC and wrong about the bug report I have put in for printing on the MAC. It seems PB tells you the entire printable area regardless.
If right then we do not need to do anything to get printer margins etc except maybe to warn users that set margins very small that they are less than the printer margins I only need the Windows offsets.
Thanks for your help wilbert it got me going in the right direction I will try my printing lib on the MAC now.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.