Get PDF Properties
Use this service to get the metadata properties of a PDF. Metadata including page count, PDF version, file size, compliance levels, font info, permissions and more are provided in JSON format for easy processing.
This data can be used to: check if a document is fully text searchable (OCR), understand the e-signature certificate info, find out compliance levels (e.g., PDF/A and PDF/UA), assess file size before compressing, check permissions related to copy, edit, printing, encryption, and much more.
Rest API
See our public API Reference for PDF Properties.
Fetch PDF Properties
The sample below fetches the properties of an input PDF.
Please refer the API usage guide to understand how to use our APIs.
Java
.NET
Node JS
Rest API
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_java_samples2// Run the sample:3// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.pdfproperties.GetPDFProperties45 public class GetPDFProperties {67 // Initialize the logger.8 private static final Logger LOGGER = LoggerFactory.getLogger(GetPDFProperties.class);910 public static void main(String[] args) {1112 try {1314 // Initial setup, create credentials instance.15 Credentials credentials = Credentials.serviceAccountCredentialsBuilder()16 .fromFile("pdfservices-api-credentials.json")17 .build();1819 //Create an ExecutionContext using credentials and create a new operation instance.20 ExecutionContext executionContext = ExecutionContext.create(credentials);21 PDFPropertiesOperation pdfPropertiesOperation = PDFPropertiesOperation.createNew();2223 // Provide an input FileRef for the operation24 FileRef source = FileRef.createFromLocalFile("src/main/resources/pdfPropertiesInput.pdf");25 pdfPropertiesOperation.setInputFile(source);2627 // Build PDF Properties options to include page level properties and set them into the operation28 PDFPropertiesOptions pdfPropertiesOptions = PDFPropertiesOptions.PDFPropertiesOptionsBuilder()29 .includePageLevelProperties(true)30 .build();31 pdfPropertiesOperation.setOptions(pdfPropertiesOptions);3233 // Execute the operation ang get properties of the PDF in PDFProperties object.34 PDFProperties result = pdfPropertiesOperation.execute(executionContext);3536 // Get properties of the PDF37 LOGGER.info("The Page level properties of the PDF: {}", result.getDocument().getPageCount());38 LOGGER.info("The Fonts used in the PDF: ");39 for(Font font: result.getDocument().getFonts()) {40 LOGGER.info(font.getName());41 }4243 } catch (ServiceApiException | IOException | SdkException | ServiceUsageException ex) {44 LOGGER.error("Exception encountered while executing operation", ex);45 }46 }47 }
Copied to your clipboard1// Get the samples from https://www.adobe.com/go/pdftoolsapi_net_samples2// Run the sample:3// cd PDFPropertiesAsJSONObject/4// dotnet run GetPDFProperties.csproj56namespace GetPDFProperties7{8 class Program9 {10 private static readonly ILog log = LogManager.GetLogger(typeof(Program));11 static void Main()12 {13 //Configure the logging14 ConfigureLogging();15 try16 {17 // Initial setup, create credentials instance.18 Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()19 .FromFile(Directory.GetCurrentDirectory() + "/pdfservices-api-credentials.json")20 .Build();2122 //Create an ExecutionContext using credentials and create a new operation instance.23 ExecutionContext executionContext = ExecutionContext.Create(credentials);24 PDFPropertiesOperation pdfPropertiesOperation = PDFPropertiesOperation.CreateNew();2526 // Provide an input FileRef for the operation27 FileRef source = FileRef.CreateFromLocalFile(@"pdfPropertiesInput.pdf");28 pdfPropertiesOperation.SetInput(source);2930 // Build PDF Properties options to include page level properties and set them into the operation31 PDFPropertiesOptions pdfPropertiesOptions = PDFPropertiesOptions.PDFPropertiesOptionsBuilder()32 .IncludePageLevelProperties(true)33 .Build();34 pdfPropertiesOperation.SetOptions(pdfPropertiesOptions);3536 // Execute the operation ang get properties of the PDF in PDFProperties object.37 PDFProperties pdfProperties = pdfPropertiesOperation.Execute(executionContext);38 Console.WriteLine("The resultant PDF Properties are: " + result.ToString());3940 }41 catch (ServiceUsageException ex)42 {43 log.Error("Exception encountered while executing operation", ex);44 }45 // Catch more errors here. . .46 }4748 static void ConfigureLogging()49 {50 ILoggerRepository logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());51 XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));52 }53 }54}
Copied to your clipboard1// Get the samples from http://www.adobe.com/go/pdftoolsapi_node_sample2// Run the sample:3// node src/exportpdf/get-pdf-properties.js45const PDFServicesSdk = require('@adobe/pdfservices-node-sdk');67try {8 // Initial setup, create credentials instance.9 const credentials = PDFServicesSdk.Credentials10 .serviceAccountCredentialsBuilder()11 .fromFile("pdfservices-api-credentials.json")12 .build();1314 //Create an ExecutionContext using credentials and create a new operation instance.15 const executionContext = PDFServicesSdk.ExecutionContext.create(credentials),16 pdfPropertiesOperation = PDFServicesSdk.PDFProperties.Operation.createNew();1718 // Set operation input from a source file.19 const input = PDFServicesSdk.FileRef.createFromLocalFile('resources/pdfPropertiesInput.pdf');20 pdfPropertiesOperation.setInput(input);2122 // Provide any custom configuration options for the operation.23 const options = new PDFServicesSdk.PDFProperties.options.PDFPropertiesOptions.Builder()24 .includePageLevelProperties(true)25 .build();26 pdfPropertiesOperation.setOptions(options);2728 // Execute the operation ang get properties of the PDF in PDFProperties object.29 pdfPropertiesOperation.execute(executionContext)30 .then(result => console.log("The resultant json object is : " + JSON.stringify(result, null, 4)))31 .catch(err => {32 if(err instanceof PDFServicesSdk.Error.ServiceApiError33 || err instanceof PDFServicesSdk.Error.ServiceUsageError) {34 console.log('Exception encountered while executing operation', err);35 } else {36 console.log('Exception encountered while executing operation', err);37 }38 });39} catch (err) {40 console.log('Exception encountered while executing operation', err);41}
Copied to your clipboard1// Please refer our Rest API docs for more information2// https://developer.adobe.com/document-services/docs/apis/#tag/PDF-Properties34curl --location --request POST 'https://pdf-services.adobe.io/operation/pdfproperties' \5--header 'x-api-key: {{Placeholder for client_id}}' \6--header 'Content-Type: application/json' \7--header 'Authorization: Bearer {{Placeholder for token}}' \8--data-raw '{9 "assetID": "urn:aaid:AS:UE1:23c30ee0-2e4d-46d6-87f2-087832fca718",10 "pageLevel": false11}'1213// Legacy API can be found here14// https://documentcloud.adobe.com/document-services/index.html#post-pdfProperties