Edit in GitHubLog an issue

Remove Protection

Remove password security from a PDF document. This can only be accomplished with the owner password of the document which must be passed in the operation.

Rest API

See our public API Reference for Remove Protection

Remove security from PDFs

Use the below sample to remove security from a PDF document.

Please refer the API usage guide to understand how to use our APIs.

Copied to your clipboard
// Get the samples from https://www.adobe.com/go/pdftoolsapi_java_samples
// Run the sample:
// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.removeprotection.RemoveProtection
public class RemoveProtection {
// Initialize the logger.
private static final Logger LOGGER = LoggerFactory.getLogger(RemoveProtection.class);
public static void main(String[] args) {
try {
// Initial setup, create credentials instance.
Credentials credentials = Credentials.servicePrincipalCredentialsBuilder()
.withClientId("PDF_SERVICES_CLIENT_ID")
.withClientSecret("PDF_SERVICES_CLIENT_SECRET")
.build();
// Create an ExecutionContext using credentials and create a new operation instance.
ExecutionContext executionContext = ExecutionContext.create(credentials);
RemoveProtectionOperation removeProtectionOperation = RemoveProtectionOperation.createNew();
// Set operation input from a source file.
FileRef source = FileRef.createFromLocalFile("src/main/resources/removeProtectionInput.pdf");
removeProtectionOperation.setInput(source);
// Set the password for removing security from a PDF document.
removeProtectionOperation.setPassword("password");
// Execute the operation.
FileRef result = removeProtectionOperation.execute(executionContext);
// Save the result to the specified location.
result.saveAs("output/removeProtectionOutput.pdf");
} catch (IOException | ServiceApiException | SdkException | ServiceUsageException e) {
LOGGER.error("Exception encountered while executing operation", e);
}
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.