Sample Code VB.NET
Imports SelectPdf Namespace Controllers Public Class PageSettingsController Inherits Controller ' GET: PageSettings Public Function Index() As ActionResult Return View() End Function <HttpPost> Public Function SubmitAction(collection As FormCollection) As ActionResult ' create a new pdf document Dim doc As New PdfDocument() ' create a new pdf font Dim font As PdfFont = doc.AddFont(PdfStandardFont.Helvetica) font.Size = 18 ' add a new page to the document ' (with specific page size, margins and orientation) Dim page As PdfPage = doc.AddPage(PdfCustomPageSize.A4, New PdfMargins(0.0F), PdfPageOrientation.Portrait) ' create a new text element and add it to the page Dim text As New PdfTextElement(0, 0, Helper.SomeText(), font) page.Add(text) ' add a new page to the document ' (with specific page size, margins and orientation) Dim page2 As PdfPage = doc.AddPage(PdfCustomPageSize.Letter, New PdfMargins(20.0F), PdfPageOrientation.Landscape) ' create a new text element and add it to the page Dim text2 As New PdfTextElement(0, 0, Helper.SomeText(), font) page2.Add(text2) ' save pdf document Dim pdf As Byte() = doc.Save() ' close pdf document doc.Close() ' return resulted pdf document Dim fileResult As FileResult = New FileContentResult(pdf, "application/pdf") fileResult.FileDownloadName = "Document.pdf" Return fileResult End Function End Class End Namespace