Hi José,
I guess I am doing it wrong but I can't seem to set any properties in CPrint. Here's a sample of me trying to set Paper Size and Orientation but it is the same for everything I have tried.
'#CONSOLE ON
#define UNICODE
#INCLUDE ONCE "Afx/CPrint.inc"
#INCLUDE ONCE "Afx/CGdiplus/CGdiplus.inc"
USING Afx
DIM pPrint AS CPrint
pPrint.AttachPrinter("Microsoft Print to PDF")
DIM HRX as long = pPrint.GetHorizontalResolution()
DIM HRY as long = pPrint.GetVerticalResolution ()
Print "Print Area pix:", HRX, HRY
DIM PPIX as long = pPrint.GetPPIX()
DIM PPIY as long = pPrint.GetPPIY()
Print "Resolution dpi:", PPIX, PPIY
DIM PWmm as long = (HRX/PPIX)*25.4
DIM PHmm as long = (HRY/PPIY)*25.4
Print "Print Area mm:", PWmm,PHmm
Dim WX as long = pPrint.GetHorizontalUnits()
Dim WY as long = pPrint.GetVerticalUnits()
Print "World Units:",, WX,WY
Dim PaperW as long = pPrint.PaperWidth
Dim PaperL as long = pPrint.PaperLength
Print "Paper Size 0.1 mm:", PaperW,PaperL
Dim PO as long = pPrint.Orientation
Print "Orientation:",, PO
DIM wszOutput AS WSTRING * MAX_PATH = ExePath & "\GdiplusPrint.pdf"
DIM hdcPrint AS HDC = pPrint.GetDC
DIM docInfo AS DOCINFOW
docInfo.cbSize = SIZEOF(DOCINFOW)
docInfo.lpszDocName = CAST(LPCWSTR, @"GdiplusPrint")
docInfo.lpszOutput = @wszOutput
dim PaperSet as boolean = pPrint.SetPaperSize (2800, 1900)
Print "Paper Size set:", PaperSet
pPrint.Orientation = DMORIENT_LANDSCAPE
Print "Orientation:",, pPrint.Orientation
StartDocW(hdcPrint, @docInfo)
StartPage(hdcPrint)
SCOPE
DIM graphics AS CGpGraphics = hdcPrint
DIM pen AS CGpPen = GDIP_ARGB(255, 255, 0, 0)
graphics.DrawLine(@pen, 0, 0, WX, WY)
graphics.DrawRectangle(@pen, 0, 0, WX-2, WY-2)
graphics.DrawEllipse(@pen, 0, 0, WX-1, WY-1)
END SCOPE
EndPage(hdcPrint)
EndDoc(hdcPrint)
PRINT "Press any key to end..."
SLEEP
Any help would be greatly appreciated..