Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, December 1, 2017 5:56:14 PM(UTC)
Nick Villalobos

Groups: Registered
Posts: 119

Was thanked: 4 time(s) in 4 post(s)

Sometimes you may receive a PDF that you wish to view within a LEADTOOLS viewer but the PDF is locked, or contains a password to view it. Within the RasterCodecs Class, there is an Options Property that gets or sets the load and save options for the RasterCodecs. These options are categorized into groups corresponding to the image format they are applied to.

If you want to programmatically unlock the PDF then you will need to use the PDF Password options. See below for a simple code snippet on how you can unlock the PDF, then resave it without the password.

Code:
using (RasterCodecs codecs = new RasterCodecs())
{
    codecs.Options.Pdf.Load.Password = "PASSWORD OF THE PDF";

    RasterImage image = codecs.Load(@"Password.pdf");

    codecs.Save(image, @"NoPassword.pdf", RasterImageFormat.RasPdf, 0);
}
Nick Villalobos
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.028 seconds.