Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support


All forums · Statistics · Search ·

Two Pilots forum / Converters / Control top/bottom margins and header/footer
Author Message
dgenard
# Posted: 15 Mar 2007 11:19


Hello,

The PDF generated from our HTML pages with HTML2PDF have very small top/bottom margins.
Is it possible to control the size of top/bottom margins and add a header or footer (page #, title, ...)

Regards,

Denis

Stanislav
Member
# Posted: 15 Mar 2007 11:37


Dear Denis,

Yes, you can setup margins using properties MarginTop, MarginBottom, MarginLeft, MarginRight.

Best regards,
Stanislav
Two Pilots
www.colorpilot.com

mvf
Member
# Posted: 15 Mar 2007 22:35


You can add header info like in this example (VB Script):

'--------------------
Set PDF = CreateObject("PDFCreatorPilot3.PDFDocument3")
Set HTML = CreateObject("HTML2PDFAddon.HTML2PDF2")
PDF.StartEngine "demo@demo", "demo"
PDF.AutoLaunch = TRUE
PDF.FileName = "out.pdf"
PDF.Resolution = 96
PDF.BeginDoc
HTML.StartHTMLEngine "",""
HTML.ConnectToPDFLibrary PDF
HTML.MarginTop = 20
HTML.MarginBottom = 20
HTML.LoadHTMLFile "your_html_file.htm"
pages = HTML.TotalPageCount
for i=0 to pages-1
HTML.ConvertPage i 'Convert page to PDF
strHeader = "SomeTitle, Page " & (i+1)
l = PDF.PDFPAGE_Width / 2
l = l - PDF.PDFPAGE_GetTextWidth(strHeader) / 2
t = 8
PDF.PDFPAGE_SetActiveFont "Verdana", FALSE, FALSE, FALSE, FALSE, 8.0, 0
PDF.PDFPAGE_SetRGBColor 0, 0, 0
PDF.PDFPAGE_TextOut l, t, 0.0, strHeader
if i<>pages-1 then HTML.SafeNewPage
next
HTML.DisconnectFromPDFLibrary
PDF.EndDoc
Set HTML = nothing
Set PDF = nothing
'--------------------

 

 

Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.013

 

Page top