Harupdf e máximo de linhas/colunas
Enviado: 22 Ago 2013 20:33
Estou tentando definir a quantidade de colunas para um PDF.
Alguém conhece alguma fórmula prática?
Por enquanto estou usando as fórmulas abaixo, que foram as mais próximas.
Já tentei fazer uso de:
HPDF_Page_GetTextLeading( ::oPdfPage )
HPDF_Page_GetLineSpacing( ::oPdfPage )
HPDF_Page_GetCharSpace( ::oPdfPage )
HPDF_Page_GetLineWidth( ::oPdfPage )
HPDF_Page_GetHorizontalSpacing( ::oPdfPage )
Mas a maioria retorna 0.
Com certeza, testo pela página, após criar a página e definir fonte.
Alguém conhece alguma fórmula prática?
Por enquanto estou usando as fórmulas abaixo, que foram as mais próximas.
Código: Selecionar todos
METHOD MaxRow() CLASS PDFGenClass
LOCAL nPageHeight, nFontSize, nMaxRow
nPageHeight := HPDF_Page_GetHeight( ::oPdfPage )
nFontSize := HPDF_Page_GetCurrentFontSize( ::oPdfPage )
nMaxRow := Int( nPageHeight / nFontSize )
RETURN nMaxRow
METHOD MaxCol() CLASS PDFGenClass
LOCAL nPageWidth, nFontSize, nMaxCol
nPageWidth := HPDF_Page_GetWidth( ::oPdfPage )
nFontSize := HPDF_Page_GetCurrentFontSize( ::oPdfPage )
nMaxCol := Int( nPageWidth / nFontSize * 1.6 )
RETURN nMaxCol
HPDF_Page_GetTextLeading( ::oPdfPage )
HPDF_Page_GetLineSpacing( ::oPdfPage )
HPDF_Page_GetCharSpace( ::oPdfPage )
HPDF_Page_GetLineWidth( ::oPdfPage )
HPDF_Page_GetHorizontalSpacing( ::oPdfPage )
Mas a maioria retorna 0.
Com certeza, testo pela página, após criar a página e definir fonte.
Código: Selecionar todos
::oPdf := HPDF_New()
HPDF_SetCompressionMode( ::oPdf, HPDF_COMP_ALL )
::oPdfPage := HPDF_AddPage( ::oPdf )
HPDF_Page_SetSize( ::oPdfPage, HPDF_PAGE_SIZE_A4, iif( lPortrait, HPDF_PAGE_PORTRAIT, HPDF_PAGE_LANDSCAPE ) )
HPDF_Page_SetFontAndSize( ::oPdfPage, HPDF_GetFont( ::oPdf, ::cFontName, NIL ), ::nFontSize )