←Select platform

Decrypt Property

Summary

Provides options for loading any encrypted file.

Syntax

C#
Objective-C
C++/CLI
Java
Python
public CodecsDecryptOptions Decrypt { get; } 
@property (nonatomic, assign) LTCodecsDecryptOptions Decrypt 
public CodecsDecryptOptions getDecrypt() 
public: 
property CodecsDecryptOptions Decrypt { 
   bool get(); 
} 
Decrypt # get  (CodecsLoadOptions) 

Property Value

Class containing password values used to decrypt files.

Remarks

Provide the password for decrypting files using this property or through the RasterCodecs.DecryptPassword event.

The RasterCodecs.Pdf.Load.Password property can also be used for loading encrypted PDF files.

The difference is that RasterCodecs.Decrypt.Password can be used for decrypting any files, whereas RasterCodecs.Pdf.Load.Password can be used to only decrypt PDF files.

Example

C#
Java
using Leadtools; 
using Leadtools.Codecs; 
 
using Leadtools.ImageProcessing.Core; 
using Leadtools.Pdf; 
 
public void CodecsLoadOptionsDecrypt_Example() 
{ 
   /* This sample loads Encrypted.docx, which is encrypted with the password 'MyPassword' */ 
   using (RasterCodecs codecs = new RasterCodecs()) 
   { 
      string srcFile = @"Encrypted.docx"; 
 
      codecs.Options.Load.Decrypt.Password = "MyPassword"; 
      codecs.Options.Load.AllPages = true; 
 
      using (RasterImage image = codecs.Load(srcFile)) 
      { 
         codecs.Save(image, srcFile + ".tif", RasterImageFormat.TifLzw, 0); 
      } 
   } 
} 
 
import java.io.File; 
import java.io.IOException; 
import java.net.URI; 
import java.net.URISyntaxException; 
import java.nio.file.Paths; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.imageprocessing.core.MinMaxBitsCommand; 
 
 
public void codecsLoadOptionsDecryptExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String srcFile = combine(LEAD_VARS_IMAGES_DIR, "Encrypted.pdf"); 
   RasterCodecs codecs = new RasterCodecs(); 
 
   codecs.getOptions().getLoad().getDecrypt().setPassword("MyPassword"); 
   codecs.getOptions().getLoad().setAllPages(true); 
 
   RasterImage image = codecs.load(srcFile); 
 
   codecs.save(image, srcFile + ".tif", RasterImageFormat.TIFLZW, 0); 
 
   assertTrue("File unsuccessfully saved to " + srcFile + ".tif", (new File(srcFile + ".tif")).exists()); 
   System.out.printf("File successfully saved to %s%n", srcFile + ".tif"); 
 
   image.dispose();; 
   codecs.dispose();; 
} 

Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Codecs Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.