Provides extra options for loading and saving PDF images.
Object Model
Syntax
Visual Basic (Declaration) | |
---|
Public Class CodecsPdfOptions |
C# | |
---|
public class CodecsPdfOptions |
C++/CLI | |
---|
public ref class CodecsPdfOptions |
Example
Visual Basic | Copy Code |
---|
Public Sub CodecsPdfOptionsExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim srcFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "PDFSegmentation.pdf"
If codecs.Options.Pdf.IsEngineInstalled Then
codecs.Options.Pdf.Load.DisplayDepth = 24
codecs.Options.Pdf.Load.GraphicsAlpha = 4
codecs.Options.Pdf.Load.Password = ""
codecs.Options.Pdf.Load.TextAlpha = 4
codecs.Options.Pdf.Load.UseLibFonts = True
codecs.Options.Pdf.Load.XResolution = 150
codecs.Options.Pdf.Load.YResolution = 150
Dim image As RasterImage = codecs.Load(srcFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)
codecs.Options.Pdf.Save.AssembleDocument = True
codecs.Options.Pdf.Save.ExtractText = True
codecs.Options.Pdf.Save.ExtractTextGraphics = True
codecs.Options.Pdf.Save.PrintDocument = False
codecs.Options.Pdf.Save.FillForm = True
codecs.Options.Pdf.Save.ModifyAnnotation = True
codecs.Options.Pdf.Save.ModifyDocument = True
codecs.Options.Pdf.Save.OwnerPassword = "LEAD Technologies"
codecs.Options.Pdf.Save.PrintFaithful = False
codecs.Options.Pdf.Save.TextEncoding = CodecsPdfTextEncoding.Hex
codecs.Options.Pdf.Save.Use128BitEncryption = True
codecs.Options.Pdf.Save.UserPassword = "LEAD"
codecs.Options.Pdf.Save.SavePdfA = False
codecs.Options.Pdf.Save.SavePdfv14 = False
codecs.Options.Pdf.Save.SavePdfv15 = False
codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "PDFSegmentation_test.pdf", RasterImageFormat.RasPdf, 24)
image.Dispose()
image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "PDFSegmentation_test.pdf")
codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "pdf.bmp", RasterImageFormat.Bmp, image.BitsPerPixel)
image.Dispose()
Else
MessageBox.Show("PDF Engine is not installed!")
End If
codecs.Dispose()
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void CodecsPdfOptionsExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); string srcFileName = LeadtoolsExamples.Common.ImagesPath.Path + "PDFSegmentation.pdf"; // Check if the PDF engine is installed then get the load and save options of the PDF files. if (codecs.Options.Pdf.IsEngineInstalled) { // Resulting image pixel depth. codecs.Options.Pdf.Load.DisplayDepth = 24; codecs.Options.Pdf.Load.GraphicsAlpha = 4; codecs.Options.Pdf.Load.Password = @""; // Type of font anti-aliasing to use. codecs.Options.Pdf.Load.TextAlpha = 4; codecs.Options.Pdf.Load.UseLibFonts = true; // Horizontal,vertical display resolution in dots per inch. codecs.Options.Pdf.Load.XResolution = 150; codecs.Options.Pdf.Load.YResolution = 150; RasterImage image = codecs.Load(srcFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1); // Set access rights for the user when he\she opens the file we create codecs.Options.Pdf.Save.AssembleDocument = true; codecs.Options.Pdf.Save.ExtractText = true; codecs.Options.Pdf.Save.ExtractTextGraphics = true; codecs.Options.Pdf.Save.PrintDocument = false; codecs.Options.Pdf.Save.FillForm = true; codecs.Options.Pdf.Save.ModifyAnnotation = true; codecs.Options.Pdf.Save.ModifyDocument = true; codecs.Options.Pdf.Save.OwnerPassword = "LEAD Technologies"; codecs.Options.Pdf.Save.PrintFaithful = false; codecs.Options.Pdf.Save.TextEncoding = CodecsPdfTextEncoding.Hex; codecs.Options.Pdf.Save.Use128BitEncryption = true; codecs.Options.Pdf.Save.UserPassword = "LEAD"; codecs.Options.Pdf.Save.SavePdfA = false; codecs.Options.Pdf.Save.SavePdfv14 = false; codecs.Options.Pdf.Save.SavePdfv15 = false; // Save the image back as PDF codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "PDFSegmentation_test.pdf", Leadtools.RasterImageFormat.RasPdf, 24); // And Load it back image.Dispose(); image = codecs.Load( LeadtoolsExamples.Common.ImagesPath.Path + "PDFSegmentation_test.pdf"); codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "pdf.bmp", RasterImageFormat.Bmp, image.BitsPerPixel); image.Dispose(); } else MessageBox.Show("PDF Engine is not installed!"); // Clean up codecs.Dispose(); RasterCodecs.Shutdown(); } |
Inheritance Hierarchy
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also