VB.NET: Generate PDF Document

How to Generate, customize PDF documents using VB.NET
Yiigo provides .NET PDF generating support included in Yiigo.Image for .NET, which can be easily added to your document imaging applications with fully-featured PDF generating, editing, manipulating, saving and printing functionalities. Find more PDF generating information on Yiigo.Imaging for .NET PDF Generating Plugin.
Yiigo.Imaging for .NET PDF Generating Plugin has those following functionalities:
  • Create or Write PDF documents from file or Stream
  • Create PDF document in a few minutes
  • Customize PDF document according to your needs, such as deskew, binarize, despeckle
  • Embed barcode, compressed images and more into PDF documents
  • Encrypt and decrypt PDF documents when you need
  • Add and edit the bookmarks of a PDF
  • Save PDF documents into local folder or other device
  • Print PDF document via compatible printers
For VB.NET developers, Yiigo provides online tutorials to generate, customize, save and print PDF documents using Yiigo.Image for .NET and .NET PDF Generating Plugin in details. Find more PDF generating tutorials on PDF Generating Support for Visual C#.NET, Web Imaging Viewer PDF Generating Support and Generate PDF Documents in .NET Winforms.
Generate PDF Documents with VB.NET Sample Code

Requirements

Before generating and manipulating PDF documents in VB.NET, make sure that you have installed.

Start to Generate PDF Documents

  • Start your Microsoft Visual Studio;
  • Choose "Project" in "File-New" from the menu;
  • In "New Project" dialog box, choose "Visual Basic Projects";
  • Choose "Windows Application" in the "Templates" List and name it "YiigoImagingPdfGenerateVBNET";
  • In the "Solution Explorer" window from the context menu, right-click on the "References" folder, and select "Add Reference...";
  • In the "Add Reference" dialog box, select the ".NET" tab and browse to Yiigo.Imaging.Net.dll library and Yiigo.Imaging.Net.Pdf.Generate.dll;
  • Add it to your VB.NET applications;
  • Import Yiigo .NET Image Namespace & copy those following codes:
Imports System.IO
Imports System.Drawing.Printing
Imports Yiigo.Imaging
Imports Yiigo.Imaging.Processing
Imports Yiigo.Imaging.PdfGenerate

' Create a basic PDF
Dim pdf As New PDFGeneratorDocument()
Dim page As PDFGeneratorPage = DefaultPages.Letter
pdf.Pages.Add(page)
Dim font As String = New Font("Arial", 10F, FontStyle.Regular)
Dim line As New TextLine(font, 12, "Yiigo", New PdfPoint(72, 400))
page.DrawingLine.Add(line)

' Add some graphics on PDF
Dim graphics As PDFGeneratorGraphics = DefaultPages.Letter
graphics.DrawRectangle = (System.Drawing.Color.Red, 5, new Rectangle(20, 20, 250, 200)
graphics.EllipseRectangle = (System.Drawing.Color.Red, 5, piont1(10.0F, 30.0F), Point2(50.0F, 30.0F))
graphics.BezierRectangle = (System.Drawing.Color.Red, 5, piont1(10.0F, 30.0F), Point2(50.0F, 340.0F)) piont3(15.0F, 55.0F),
Point4(50.0F, 30.0F)))

' Save & print PDF
pdf.SaveToFile(String FilePath)
pdf.SaveToStream(Stream Stream)
pdf.print()
Products
Other Plugins
Image Viewer CoreBarcode PluginPDF Read & WriteTesseract OCR PluginForm Processing PluginJBIG2 CodecJPEG2000 CodecISIS ScannerTwain ScannerDICOM ReaderCAD Scanner