Build a PDF document


In my web app I need to email a pdf document containing information about a purchase order.
How would I build a neatly formatted pdf document using
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can use pdfsharp library to create PDF document with VB.Net. You can dowload it from this site:
This simple code can help to crete PDF with this library:
Imports PdfSharp
Imports PdfSharp.Drawing
Imports PdfSharp.Pdf

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim pdf As PdfDocument = New PdfDocument
        pdf.Info.Title = "My First PDF"
        Dim pdfPage As PdfPage = pdf.AddPage
        Dim graph As XGraphics = XGraphics.FromPdfPage(pdfPage)
        Dim font As XFont = New XFont("Verdana", 20, XFontStyle.Bold)
        graph.DrawString("This is my first PDF document", font, XBrushes.Black, _
        New XRect(0, 0, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.Center)
        Dim pdfFilename As String = "firstpage.pdf"
    End Sub
End Class

Open in new window

Ryan ChongCommented:
I'm using iTextSharp.

You can get it via Nuget Package Manager.


you can further google for plenty of examples.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.