Rank: Newbie Groups: Member
Joined: 8/1/2011 Posts: 2
|
The following Visual Basic .NET code successfully creates a pdf page in landscape format:
Dim doc As New PdfDocument() Dim pageLayout As New AcmPageLayout(New AcmPadding(0.4F)) Dim render As New AcmRender(doc, pageLayout) render.SetDefPageSize(New System.Drawing.SizeF(11.69F, 8.26F))
However I need to be able to insert page breaks in my pdf document so I attempted the following:
Dim doc As New PdfDocument() Dim pageLayout As New AcmPageLayout(New AcmPadding(0.4F)) Dim startPage As PdfPage = doc.Pages.Add() Dim render As New AcmRender(startPage, 0, pageLayout) render.SetDefPageSize(New System.Drawing.SizeF(11.69F, 8.26F))
This always results in a portrait page rather than landscape.
What am I doing wrong?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, SetDefPageSize controls the size of the pages added by the render, not page added by you directly. There are several options: 1. Set the page size explicitly. For example:
Code: Visual Basic.NET
'Start a new page
Dim startPage As PdfPage = doc.Pages.Add()
'Set the new page size
startPage.Size = new System.Drawing.SizeF(11.69F, 8.26F);
2. Use an AcmPageBreak object. For example:
Code: Visual Basic.NET
'Insert a page break between "abc" and "def"
render.Render( _
new AcmText("abc"), _
new AcmPageBreak(), _
new AcmText("def"));
Hope this helps. Please let us know if you have any more questions. Thanks
|