Created
September 23, 2020 23:20
-
-
Save benvanderberg/9999e215e74cbdfe14b7e297a30da82f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an ExecutionContext using credentials | |
const executionContext = PDFToolsSdk.ExecutionContext.create(credentials); | |
// Create a new operation instance. | |
const removeProtectionOperation = PDFToolsSdk.RemoveProtection.Operation.createNew(), | |
input = PDFToolsSdk.FileRef.createFromLocalFile( | |
'resources/removeProtectionInput.pdf', | |
PDFToolsSdk.RemoveProtection.SupportedSourceFormat.pdf | |
); | |
// Set operation input from a source file. | |
removeProtectionOperation.setInput(input); | |
// Set the password for removing security from a PDF document. | |
removeProtectionOperation.setPassword("password"); | |
// Execute the operation and Save the result to the specified location. | |
removeProtectionOperation.execute(executionContext) | |
.then(result => result.saveAsFile('output/removeProtectionOutput.pdf')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment