HelloWorld.vb
- ''
- '' This code is part of Document Solutions for PDF demos.
- '' Copyright (c) MESCIUS inc. All rights reserved.
- ''
- Imports System.IO
- Imports System.Drawing
- Imports GrapeCity.Documents.Pdf
- Imports GrapeCity.Documents.Text
-
- '' One of the simplest ways to create a "Hello, World!" PDF.
- Public Class HelloWorld
- Sub CreatePDF(ByVal stream As Stream)
- '' Create a new PDF document:
- Dim doc = New GcPdfDocument()
- '' Add a page, get its graphics:
- Dim g = doc.NewPage().Graphics
- '' Draw a string on the page.
- '' Notes:
- '' - For simplicity, here we are using a standard PDF font
- '' (the 14 standard fonts' metrics are built into DsPdf and are always available);
- '' - DsPdf coordinates start at top left corner of a page, using 72 dpi by default:
- g.DrawString(
- "Hello, World, from DsPdf and VB.NET!",
- New TextFormat With {
- .Font = StandardFonts.Times,
- .FontSize = 12
- },
- New PointF(72, 72))
- '' Save the PDF
- doc.Save(stream)
- End Sub
- End Class
-