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.
application/pdf
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 |
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. |
This code example demonstrates how to save an image to the PDF file:
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\mountain.jpg") bitmap.Save("C:\mountain.pdf", _ New Aurigma.GraphicsMill.Codecs.PdfEncoderOptions(70)) bitmap.Dispose()
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.
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()
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); } } }