AutotagPDFOperation

AutotagPDFOperation

An operation that creates PDF documents with enhanced readability from existing PDF documents. An optional tagging report can also be generated which contains the information about the tags that the tagged output PDF document contains.

Accessibility tags, used by assistive technology such as screen reader are required to make PDF files compliant. However, the generated PDF is not guaranteed to comply with accessibility standards such as WCAG and PDF/UA as there could be a need to perform further downstream remediation to meet those standards.

Sample Usage:


const credentials =  PDFServicesSdk.Credentials.servicePrincipalCredentialsBuilder()
          .withClientId("PDF_SERVICES_CLIENT_ID")
          .withClientSecret("PDF_SERVICES_CLIENT_SECRET")
          .build(),
      executionContext = PDFServicesSdk.ExecutionContext.create(credentials),
      AutotagPDF = PDFServicesSdk.AutotagPDF,
      autotagPDFOperation = AutotagPDF.Operation.createNew(),
      input = PDFServicesSdk.FileRef.createFromLocalFile(
                  'autotagPdfInput.pdf',
                  AutotagPDF.SupportedSourceFormat.pdf);

autotagPDFOperation.setInput(input);

autotagPDFOperation.execute(executionContext)
    .then(result => result.taggedPDF.saveAsFile("taggedPDFOutput.pdf"))
    .catch(err => console.log(err));

Members

(static, constant) SupportedSourceFormat

Description:
Properties:
Name Type Description
pdf string

Represents "application/pdf" media type

Supported source file formats for AutotagPDFOperation.

Methods

(static) createNew() → {AutotagPDFOperation}

Description:
Returns:

A new AutotagPDFOperation instance.

Type
AutotagPDFOperation

setInput(sourceFileRefnon-null)

Description:
  • Sets an input file.

Parameters:
Name Type Description
sourceFileRef FileRef

An input file.

setOptions(optionsopt)

Description:
  • Sets the parameters for this operation. See AutotagPDFOptions for how to specify the options.

Parameters:
Name Type Attributes Description
options AutotagPDFOptions <optional>

optional parameters; use null for default values

execute(contextnon-null) → {Promise.<AutotagPDFOutput>}

Description:
  • Executes this operation using the supplied context and returns a Promise which resolves to AutotagPDFOutput.

    The resulting file(s) may be stored in the system temporary directory (per the os.tempdir(), symlinks are resolved to the actual path). See FileRef for how temporary resources are cleaned up.

Parameters:
Name Type Description
context ExecutionContext

The context in which the operation will be executed.

Throws:
  • if an API call results in an error response.

    Type
    ServiceApiError
  • if service usage limits have been reached or credentials quota has been exhausted.

    Type
    ServiceUsageError
Returns:

A promise which resolves to the operation result.

Type
Promise.<AutotagPDFOutput>