* API declarations for Getting Paper Size DECLARE INTEGER StartPage IN GDI32 INTEGER hdc DECLARE INTEGER EndPage IN GDI32 INTEGER hdc DECLARE INTEGER EndDoc IN GDI32 INTEGER hdc DECLARE INTEGER StartDoc IN GDI32 INTEGER hdc, STRING lpdi DECLARE INTEGER OpenPrinter IN winspool.drv STRING @pPrinterName, INTEGER @phPrinter, INTEGER pDefault DECLARE INTEGER ClosePrinter IN winspool.drv INTEGER hPrinter DECLARE LONG EnumForms IN winspool.drv AS EnumForms LONG hPrinter, LONG Level, LONG pForm, LONG cbBuf, LONG @pcbNeeded, LONG @ pcReturned DECLARE INTEGER HeapCreate IN WIN32API INTEGER dwOptions, INTEGER dwInitialSize, INTEGER dwMaxSize DECLARE INTEGER HeapAlloc IN WIN32API INTEGER hHeap, INTEGER dwFlags, INTEGER dwBytes DECLARE INTEGER HeapFree IN WIN32API INTEGER hHeap, INTEGER dwFlags, INTEGER lpMem DECLARE HeapDestroy IN WIN32API INTEGER hHeap LOCAL lhHeap * Allocate a heap m.lhHeap = HeapCreate(0, 4096*10, 0) * Enumerate forms for default VFP printer LOCAL lhPrinter, lnNeeded, lnBuffer * Open a printer m.lhPrinter = 0 m.lnResult = OpenPrinter(@tcPrinterName, @lhPrinter, 0) * Get the size of the buffer required to fit all forms in lnNeeded m.lnNeeded = 0 =EnumForms(m.lhPrinter, 1, 0, 0, @lnNeeded, 0) * Get the list of forms m.lnBuffer = HeapAlloc(m.lhHeap, 0, m.lnNeeded) =EnumForms(m.lhPrinter, 1, m.lnBuffer, @lnNeeded, @lnNeeded, 0) * Get the information for the desired Paper ID obtained from PRTINFO(2) * The form attributes are stored in in thousandths of millimeters m.lnPointer = m.lnBuffer + (PRTINFO(2) - 1) * 32 m.lnPageWidth = CTOBIN(SYS(2600, (m.lnPointer+ 8), 4),"4RS") / 100 m.lnPageHeight = CTOBIN(SYS(2600, (m.lnPointer+12), 4),"4RS") / 100 = HeapFree(m.lhHeap, 0, m.lnBuffer ) = ClosePrinter(m.lhPrinter) * Clear the Heap IF m.lhHeap <> 0 HeapDestroy(m.lhHeap) ENDIF * Adjust page Width and Height m.lnPageWidth = (m.lnPageWidth / 100 / 2.54) * m.lnHorRes m.lnPageHeight = (m.lnPageHeight / 100 / 2.54) * m.lnVertRes ? lnPageWidth, lnPageHeightThanks in advance