This documentation is for the old version. Go to the latest Graphics Mill docs

PDF File Format

PDF stands for Portable Document Format. This format was developed by Adobe Systems Incorporated for the secure and reliable distribution and exchange of electronic documents and nowadays this formats became standard de facto in this field. In general this formats contain not only raster images, but also vector data and texts. However Graphics Mill for .NET can only embed raster images to PDF file. You can write multiple pages to the PDF file. This format is supported for saving only.

Format Name

PDF

MIME Type

application/pdf

File Extensions

*.pdf

Supported Pixel Formats

Description Read Write
1 bit palette-based No Yes
4 bit palette-based No Yes
8 bit palette-based No Yes
24 bit RGB No Yes
32 bit RGB No Yes
32 bit RGB with alpha-channel No Yes
32 bit premultiplied RGB with alpha-channel No Yes
32 bit CMYK No Yes

Encoder Options

Name Default Value Comments
PdfEncoderOptions.Compression
PdfFrame.Compression
CompressionType.Zip Value that specifies necessary PDF compression type.
PdfEncoderOptions.Quality
PdfFrame.Quality
75 Value in range [0, 100] specifying JPEG quality.

Examples

This code example demonstrates how to save an image to the PDF file:

Visual Basic
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\mountain.jpg")

bitmap.Save("C:\mountain.pdf", _
    New Aurigma.GraphicsMill.Codecs.PdfEncoderOptions(70))

bitmap.Dispose()
C#
using (Aurigma.GraphicsMill.Bitmap bitmap = 
           new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.jpg"))
{
    bitmap.Save(@"C:\Mountain.pdf", 
        new Aurigma.GraphicsMill.Codecs.PdfEncoderOptions(70));
}

The same, but using PdfWriter class. This class provides more flexible file saving support. In particular, you can use asynchronous mode, etc.

Visual Basic
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.jpg")

Dim writer As New Aurigma.GraphicsMill.Codecs.PdfWriter("C:\Mountain.pdf")

Dim frame As New Aurigma.GraphicsMill.Codecs.PdfFrame
frame.Quality = 70
frame.SetBitmap(bitmap)

bitmap.Dispose()

writer.AddFrame(frame)

frame.Dispose()

writer.Dispose()
C#
using (Aurigma.GraphicsMill.Bitmap bitmap = 
           new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.jpg"))
{
    using (Aurigma.GraphicsMill.Codecs.PdfWriter writer = 
               new Aurigma.GraphicsMill.Codecs.PdfWriter(@"C:\Mountain.pdf"))
    {
        using (Aurigma.GraphicsMill.Codecs.PdfFrame frame = 
                   new Aurigma.GraphicsMill.Codecs.PdfFrame())
        {
            frame.Quality = 70;
            frame.SetBitmap(bitmap);
        
            writer.AddFrame(frame);                    
        }
    }        
}