This page intentionally left blank
Loosely Typed in Ohio

I <3 iTextSharp

I’ve just started using iTextSharp, a .NET port of the Java iText library. It’s surprisingly good.

The library can create files or streams of PDF. I’m caching my output, so this example uses files:

        // create a document
        Document document = new Document();

        // associate it with a file
        String filepath = Request.MapPath("/Pdfs/test.pdf");
        FileStream file = new FileStream(filepath, FileMode.Create);
        PdfWriter.GetInstance(document, file);

        // write the pdf
        document.Open();
        document.Add(new Paragraph("OMG this thing works"));
        document.Close();

Leave your mark

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Close
E-mail It
Socialized through Gregarious 42