Converting Documents

Here we convert some documents into various file formats.

The code examples here are fairly trivial because this kind of conversion is designed to be simple.

Conversion to PDF
C#
static class Program {
    static void Main() {
        using(var doc = new WebSupergoo.WordGlue4.Doc("test.docx"))
            doc.SaveAs("output.pdf");
    }
}
Conversion to XPS
C#
static class Program {
    static void Main() {
        using(var doc = new WebSupergoo.WordGlue4.Doc("test.docx"))
            doc.SaveAs("output.xps");
    }
}
Conversion to PDF using ABCpdf
C#
static class Program {
    static void Main() {
        using(var doc = new WebSupergoo.WordGlue4.Doc("test.docx"))
        using(var pdf = new WebSupergoo.ABCpdf13.Doc()) {
            doc.Render(pdf);
            pdf.Save("output.pdf");
        }
    }
}
Drawing a page to System.Drawing
C#
using WebSupergoo.WordGlue4;
static class Program {
    static void Main() {
        using(var doc = new Doc("test.docx"))
        using(Graphics g = CreateMyGraphics())
            doc.Render(new GdiRenderingContext(g), 1);
    }
}