Welcome Guest Search | Active Topics | Sign In | Register

Landscape PdfPage Options
David Eaglesham
Posted: Monday, August 1, 2011 7:21:33 AM
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?


eo_support
Posted: Monday, August 1, 2011 7:36:29 AM
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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.