I made a test with my class now.
Add to VAR:
VAR nPageWidth INIT 595.28 // A4
VAR nPageHeight INIT 841.89 // A4
Try this in AddPage, using HPDF_Page_SetRotate():
// HPDF_Page_SetSize( ::oPage, HPDF_PAGE_SIZE_A4, iif(
::nPrinterType == 2, HPDF_PAGE_PORTRAIT, HPDF_PAGE_LANDSCAPE ) )
HPDF_Page_SetWidth( ::oPage, ::nPageWidth )
HPDF_Page_SetHeight( ::oPage, ::nPageHeight )
HPDF_Page_SetRotate( ::oPage, iif( ::nPrinterType == 2, 0, 90
) )
And try this changing size only:
// HPDF_Page_SetSize( ::oPage, HPDF_PAGE_SIZE_A4, iif(
::nPrinterType == 2, HPDF_PAGE_PORTRAIT, HPDF_PAGE_LANDSCAPE ) )
IF ::nPrinterType == 2
HPDF_Page_SetWidth( ::oPage, ::nPageHeight )
HPDF_Page_SetHeight( ::oPage, ::nPageWidth )
ELSE
HPDF_Page_SetWidth( ::oPage, ::nPageWidth )
HPDF_Page_SetHeight( ::oPage, ::nPageHeight )
ENDIF
- Using pre-defined sizes and portrait/landscape, preview is ok
- Using HPDF_Page_SetRotate(), preview is rotated too
- Setting size only, for foxit reader ok, because default print is
(x)auto-rotate
Then, for preview to user, last option seems to be the best.
I do not found how change portrait/landscape without use pre-defined
layout, except using HPDF_Page_SetRotate()
Option to use:
oPDF := PDFClass():New()
oPDF:nPageWidth := oPDF:mmToPDF( 210 ) // A4
oPDF:nPageHeight := oPDF:mmToPdf( 297 ) // A4
METHOD ::mmToPDF( nMilimiters )
RETURN nMilimeters * 0.03937 * 72
José M. C. Quintas