Edit in GitHubLog an issue

PDF Accessibility Auto-Tag API

API Output Format

The output of the PDF Accessibility Auto-Tag API contains the following:

  • The tagged PDF file.
  • A report in XLSX format, if the report generation was enabled. This report provides information related to the tags found in the original document, if any, and the auto-tagged document.

API limitations


  • File size: Files up to a maximum of 100 MB are supported.
  • Number of Pages: Non-scanned PDFs up to 200 pages and scanned PDFs up to 100 pages are supported, however limits may be lower for files with a large number of tables.
  • Rate limits: Keep request rate below 25 requests per minute.
  • Page Size: The API supports standard page sizes not more than 17.5” or less than 6” in either dimension.
  • Hidden Objects: PDF files that contain content that is not visible on the page like JavaScript, OCG (optional content groups), etc are not supported. Files that contain such hidden information may fail to process. For such cases, removing hidden content prior to processing files again may return a successful result.
  • Language: The API is currently optimized for English language content. Files containing content in French, German, Spanish, Danish, Dutch, Norwegian (Bokmal), Galician, Catalan, Finnish, Italian, Swedish, Portuguese, and Romanian should return good results most of the time. Files containing content in Afrikaans, Bosnian, Croatian, Czech, Hungarian, Indonesian, Malay, Polish, Russian, Serbian, Turkish, Hindi, Marathi and other similar languages should return good results often. Non-English files may have issues with non-English punctuation. OCR is configured for English content.
  • OCR and Scan quality: The quality of text extracted from scanned files is dependent on the clarity of content in the input file and is currently configured for English content. Conditions like skewed pages, shadowing, obscured or overlapping fonts, and page resolution less than 200 DPI can all result in lower quality text output.
  • Form fields: Files containing XFA and other fillable form elements are not supported.
  • Unprotected files: The API supports files that are unprotected or where security restrictions allow editing of content. Files that are secured and do not allow editing of content will not be processed. If the password of a protected PDF is known, the permissions of the file can be modified using the PDF Services API as shown here.
  • Annotations: Content in PDF files containing annotations such as highlights and sticky notes will be processed, but annotations that obscure text could impact output quality. Text within annotations will not be included in the output.
  • PDF Producers: The PDF Accessibility Auto-Tag API is designed to add tags to PDF to make it easier to make the file accessible. Files created from applications that produce other types of content like illustrations, CAD drawings or other types of vector art may not return high quality results.
  • PDF Collections: PDFs that are made from a collection of files including PDF Portfolios are not currently supported.

Error codes

ScenarioError codeError message
Unknown error/ failureERRORUnexpected error
TimeoutTIMEOUTUnexpected error: Processing timeout
DisqualifiedDISQUALIFIEDFile is not suitable for conversion
Unsupported XFA fileDISQUALIFIED_XFAFile is not suitable for conversion: File contains an XFA form
Page limit violationDISQUALIFIED_PAGE_LIMITFile is not suitable for conversion: File exceeds page limit
Scan page limit violationDISQUALIFIED_SCAN_PAGE_LIMITFile is not suitable for conversion: Scanned file exceeds page limit
File size violationDISQUALIFIED_FILE_SIZEFile is not suitable for conversion: File exceeds size limit
Encryption permissionDISQUALIFIED_PERMISSIONSFile is not suitable for conversion: File permissions do not allow conversion
Complex fileDISQUALIFIED_COMPLEX_FILEFile is not suitable for conversion: File content is too complex
Unsupported languageDISQUALIFIED_LANGUAGEFile is not suitable for conversion: File content language is unsupported
Bad PDFBAD_PDFThe PDF file is damaged or its content is too complex
Bad PDF file typeBAD_PDF_FILE_TYPEThe input file is not a PDF file
Damaged input fileBAD_PDF_DAMAGEDThe input file is damaged
Complex tableBAD_PDF_COMPLEX_TABLEThe input file contains a table that is too complex to process
Complex contentBAD_PDF_COMPLEX_INPUTThe input file contains content that is too complex to process
Unsupported fontBAD_PDF_UNSUPPORTED_FONTThe input file contains font data that is corrupted or not supported
Large PDF fileBAD_PDF_LARGE_FILEThe input file size exceeds the maximum allowed
Protected PDFPROTECTED_PDFPDF is encrypted or password-protected
Empty or corrupted inputBAD_INPUTInput is corrupted or empty
Invalid input parametersBAD_INPUT_PARAMSInvalid input parameters
User not enrolled to allowed Atlas plansINVALID_PLAN_CODEUnauthorized to execute this operation. User is not enrolled to plans allowed for the service

REST API

See our public API Reference for PDF Accessibility Auto-Tag API.

Generate tagged PDF from a PDF

The sample below generates a tagged PDF from a PDF.

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

Copied to your clipboard
1// Get the samples from https://github.com/adobe/pdfservices-java-sdk-samples
2// Run the sample:
3// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.autotagpdf.AutotagPDF
4
5public class AutotagPDF {
6 // Initialize the logger.
7 private static final Logger LOGGER = LoggerFactory.getLogger(AutotagPDF.class);
8
9 public static void main(String[] args) {
10
11 try {
12 // Initial setup, create credentials instance.
13 Credentials credentials = Credentials.servicePrincipalCredentialsBuilder()
14 .withClientId("PDF_SERVICES_CLIENT_ID")
15 .withClientSecret("PDF_SERVICES_CLIENT_SECRET")
16 .build();
17
18 // Create an ExecutionContext using credentials and create a new operation instance.
19 ExecutionContext executionContext = ExecutionContext.create(credentials);
20 AutotagPDFOperation autotagPDFOperation = AutotagPDFOperation.createNew();
21
22 // Set operation input from a source file.
23 FileRef source = FileRef.createFromLocalFile("autotagPDFInput.pdf");
24 autotagPDFOperation.setInput(source);
25
26 // Execute the operation
27 AutotagPDFOutput autotagPDFOutput = autotagPDFOperation.execute(executionContext);
28
29 // Save the tagged PDF output at the specified location
30 autotagPDFOutput.getTaggedPDF().saveAs("autotagPDFOutput.pdf");
31
32 } catch (ServiceApiException | IOException | SdkException | ServiceUsageException ex) {
33 LOGGER.error("Exception encountered while executing operation", ex);
34 }
35 }

Generate tagged PDF by setting options with command line arguments

The sample below generates a tagged PDF by setting options through command line arguments.

Here is a sample list of command line arguments and their description:

  • --input < input file path >
  • --output < output file path >
  • --report { If this argument is present then the output will be generated with the report }
  • --shift_headings { If this argument is present then the headings will be shifted in the output PDF file }
Copied to your clipboard
1// Get the samples from https://github.com/adobe/pdfservices-java-sdk-samples
2// Run the sample:
3// mvn -f pom.xml exec:java -Dexec.mainClass=com.adobe.pdfservices.operation.samples.autotagpdf.AutotagPDFParamaterised
4
5public class AutotagPDFParameterised {
6
7 private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(AutotagPDFParameterised.class);
8
9 public static void main(String[] args) {
10 LOGGER.info("--input " + getInputFilePathFromCmdArgs(args));
11 LOGGER.info("--output " + getOutputFilePathFromCmdArgs(args));
12 LOGGER.info("--report " + getGenerateReportFromCmdArgs(args));
13 LOGGER.info("--shift_headings " + getShiftHeadingsFromCmdArgs(args));
14
15 try {
16 // Initial setup, create credentials instance.
17 Credentials credentials = Credentials.servicePrincipalCredentialsBuilder()
18 .withClientId("PDF_SERVICES_CLIENT_ID")
19 .withClientSecret("PDF_SERVICES_CLIENT_SECRET")
20 .build();
21
22 //Create an ExecutionContext using credentials and create a new operation instance.
23 ExecutionContext executionContext = ExecutionContext.create(credentials);
24
25 AutotagPDFOperation autotagPDFOperation = AutotagPDFOperation.createNew();
26
27 // Set input for operation from command line args
28 autotagPDFOperation.setInput(FileRef.createFromLocalFile(getInputFilePathFromCmdArgs(args)));
29
30 // Get and Build AutotagPDF options from command line args and set them into the operation
31 AutotagPDFOptions autotagPDFOptions = getOptionsFromCmdArgs(args);
32 autotagPDFOperation.setOptions(autotagPDFOptions);
33
34 // Execute the operation
35 AutotagPDFOutput autotagPDFOutput = autotagPDFOperation.execute(executionContext);
36
37 // Save the output files at the specified location
38 String outputPath = getOutputFilePathFromCmdArgs(args);
39 autotagPDFOutput.getTaggedPDF().saveAs(outputPath + "autotagPDFInput-tagged.pdf");
40 if (autotagPDFOptions != null && autotagPDFOptions.isGenerateReport())
41 autotagPDFOutput.getReport().saveAs(outputPath + "autotagPDFInput-report.xlsx");
42
43 }
44 catch (ServiceApiException | IOException | ServiceUsageException e) {
45 System.out.println(e);
46 }
47 }
48
49private static AutotagPDFOptions getOptionsFromCmdArgs(String[] args) {
50 Boolean generateReport = getGenerateReportFromCmdArgs(args);
51 Boolean shiftHeadings = getShiftHeadingsFromCmdArgs(args);
52
53 AutotagPDFOptions.Builder builder = AutotagPDFOptions.autotagPDFOptionsBuilder();
54
55 if (generateReport)
56 builder.generateReport();
57 if (shiftHeadings)
58 builder.shiftHeadings();
59
60 return builder.build();
61 }
62
63private static Boolean getShiftHeadingsFromCmdArgs(String[] args) {
64 return Arrays.asList(args).contains("--shift_headings");
65}
66
67private static Boolean getGenerateReportFromCmdArgs(String[] args) {
68 return Arrays.asList(args).contains("--report");
69}
70
71private static String getInputFilePathFromCmdArgs(String[] args) {
72 String inputFilePath = "src/main/resources/autotagPDFInput.pdf";
73 int inputFilePathIndex = Arrays.asList(args).indexOf("--input");
74 if (inputFilePathIndex >= 0 && inputFilePathIndex < args.length - 1) {
75 inputFilePath = args[inputFilePathIndex + 1];
76 } else
77 LOGGER.info("input file not specified, using default value : autotagPdfInput.pdf");
78
79 return inputFilePath;
80}
81
82private static String getOutputFilePathFromCmdArgs(String[] args) {
83 String outputFilePath = "output/AutotagPDFParameterised/";
84 int outputFilePathIndex = Arrays.asList(args).indexOf("--output");
85 if (outputFilePathIndex >= 0 && outputFilePathIndex < args.length - 1) {
86 outputFilePath = args[outputFilePathIndex + 1];
87 } else
88 LOGGER.info("output path not specified, using default value : " + outputFilePath);
89
90 return outputFilePath;
91}
92}
93
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.