Leadtools.Codecs Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.17
CodecsPdfOptions Class
See Also  Members   Example 
Leadtools.Codecs Namespace : CodecsPdfOptions Class




Provides extra options for loading and saving PDF images.

Object Model



Syntax

Visual Basic (Declaration) 
Public Class CodecsPdfOptions 
Visual Basic (Usage)Copy Code
Dim instance As CodecsPdfOptions
C# 
public class CodecsPdfOptions 
Managed Extensions for C++ 
public __gc class CodecsPdfOptions 
C++/CLI 
public ref class CodecsPdfOptions 

Example

Visual BasicCopy Code
CodecsPdfOptions
      Public Sub CodecsPdfOptionsExample()
         RasterCodecs.Startup()
         Dim codecs As RasterCodecs = New RasterCodecs()

         Dim srcFileName As String = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\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 Then
            ' 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

            Dim image As RasterImage = 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"

            ' Save the image back as PDF
            codecs.Save(image, "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\PDFSegmentation_test.pdf", RasterImageFormat.RasPdf, 24)

            ' And Load it back
            image.Dispose()
            image = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\PDFSegmentation_test.pdf")
            codecs.Save(image, "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\pdf.bmp", RasterImageFormat.Bmp, image.BitsPerPixel)
            image.Dispose()
         Else
            MessageBox.Show("PDF Engine is not installed!")
         End If

         ' Clean up
         codecs.Dispose()
         RasterCodecs.Shutdown()
      End Sub
C#Copy Code
CodecsPdfOptions 
      public void CodecsPdfOptionsExample() 
      { 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
 
         string srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\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"; 
 
            // Save the image back as PDF 
            codecs.Save(image, @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\PDFSegmentation_test.pdf", Leadtools.RasterImageFormat.RasPdf, 24); 
 
            // And Load it back 
            image.Dispose(); 
            image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\PDFSegmentation_test.pdf"); 
            codecs.Save(image, @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\pdf.bmp", RasterImageFormat.Bmp, image.BitsPerPixel); 
            image.Dispose(); 
         } 
         else 
            MessageBox.Show("PDF Engine is not installed!"); 
 
         // Clean up 
         codecs.Dispose(); 
         RasterCodecs.Shutdown(); 
      }

Inheritance Hierarchy

System.Object
   Leadtools.Codecs.CodecsPdfOptions

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also