Skip to content

ixmilia/pdf

Repository files navigation

IxMilia.Pdf

A portable .NET library for creating simple PDF documents based off the Adobe specification from here.

Usage

Create a PDF file:

using System.IO;
using IxMilia.Pdf;
// ...

// create the page
PdfPage page = PdfPage.NewLetter(); // 8.5" x 11"
PdfPoint topLeft = new PdfPoint(PdfMeasurement.Zero, page.Height);
PdfPoint bottomLeft = new PdfPoint(PdfMeasurement.Zero, PdfMeasurement.Zero);
PdfPoint bottomRight = new PdfPoint(page.Width, PdfMeasurement.Zero);

// add text
page.Items.Add(new PdfText("some text", new PdfFontType1(PdfFontType1Type.Helvetica), PdfMeasurement.Points(12.0), bottomLeft));

// add a line and circle
PdfPathBuilder builder = new PdfPathBuilder()
{
    new PdfLine(topLeft, bottomRight),
    new PdfCircle(new PdfPoint(page.Width / 2.0, page.Height / 2.0), page.Width / 2.0)
};
page.Items.Add(builder.ToPath());

// create the file and add the page
PdfFile file = new PdfFile();
file.Pages.Add(page);

file.Save(@"C:\Path\To\File.pdf");

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages