Free Support Forum -

Set orientation


How do I set the orientation of the pdf? I am not able to find it anywhere.

I found how to set the orientation, however it doesnt apply if I set the margin as well. Here is my code:

dim pdf as new Pdf()
dim sec as new Section

Private Function GetPageSetup() As PageSetup
Dim setup As New PageSetup

Dim margin As New MarginInfo
margin.Top = 30
margin.Bottom = 20
margin.Left = 17
margin.Right = 20

setup.Margin = margin
setup.PageHeight = PageSize.A3Height
setup.PageWidth = PageSize.A3Width
Return setup
End Function

If I remove the PageHeight and PageWidth in the setup function, I get: Page size must be positive:0,0

Any idea?


The IsLandScape property only exchanges the page width and height. You can set the page size and margin without using this property.