Validate

Validate performs validation on pdf document for PDF/A compliance.

FeatureParameterResponseActionDescriptionLinks
validateValidateValidateResValidateActionValidates a pdf for PdfA compliance.Swagger
Sample
validateDocument file,
pdfCompliance
file streamValidate performs validations on Pdf documents for PdfA compliance.
Swagger
Sample

Samples

Validate

  • curl
  • C#
  • Java
  • JavaScript
  • PHP
  • Python
  • Ruby
curl No Sample
// create validate object
var req = new Validate()
{
    // document
    Document = new Document()
    {
        DocData = File.ReadAllBytes(@"myPdf.pdf"),
        Name = "myPdf.pdf",
    },
    //action
    ValidateAction = new ValidateAction()
    {
        PdfConformance = ValidateActionPdfConformance.PdfA2u
    },
};

// validating Pdf
var res = Pdf4me.Instance.PdfAClient.ValidateAsync(req).GetAwaiter().GetResult();

//saving validation info to a json file
File.WriteAllText("validate_result.json", JsonConvert.SerializeObject(res));
// create pdf4meClient
const pdf4meClient = pdf4me.createClient('YOUR API KEY')

// create validate object
const validateReq = {
  // document
  document: {
    docData: fs.readFileSync(path.join(__dirname, 'myPdf.pdf')).toString('base64'),
  },
  // action
  validateAction: {
    pdfConformance: 'pdfA2u',
  },
}

// validate
pdf4meClient.validate(validateReq)
  .then(function(validateRes) {
    // and writing it to disk as json
    fs.writeFileSync(path.join(__dirname, 'validate_result.json'), JSON.stringify(validateRes, null, 2))
  })
  .catch(error => {
    console.log(error)
  })
// create validate object
$create_validate = [
    // document
    'document'=> [
        'name' => 'myPdf.pdf',
        'docData' => $client->getFileData('myPdf.pdf')
    ],
    // action
    'validateAction' => [
        "pdfConformance" => "pdfA2u",
    ],
];

// validating Pdf
$res = $client->pdf4me()->validate($create_validate);

// writing validation to console
echo $res["pdfValidation"];
# setup the pdfA_client
pdfA_client = PdfAClient(pdf4me_client)

# create the create_pdfA object
validate = Validate(
    document=Document(
        name = 'myPdf.pdf',
        doc_data=FileReader().get_file_data('myPdf.pdf')
    ),
    validate_action=ValidateAction(
        pdf_conformance='pdfA2u'
    )
)

# validated to PDF/A
validated = pdfA_client.validate(validate=validate)

# extracting the pdfvalidation
print(validated)

ValidateDocument

  • curl
  • C#
  • Java
  • JavaScript
  • PHP
  • Python
  • Ruby
curl No Sample
// validating
var res = Pdf4me.Instance.PdfAClient.ValidateDocumentAsync(File.ReadAllBytes("myPdf.pdf"),PdfAActionCompliance.PdfA1b).GetAwaiter().GetResult();
            
//saving validate info to a json file
File.WriteAllText("validate_result.json", JsonConvert.SerializeObject(res));
// create pdf4meClient
const pdf4meClient = pdf4me.createClient('YOUR API KEY')

// validate
pdf4meClient.validateDocument('pdfA1b', fs.createReadStream(path.join(__dirname, 'myPdf.pdf')))
  .then(function(validateRes) {
    // and writing it to disk as json
    fs.writeFileSync(path.join(__dirname, 'validate_result.json'), JSON.stringify(validateRes, null, 2))
  })
  .catch(error => {
    console.error(error)
  })
// validate
$res = $client->pdf4me()->validateDocument(
    [
        "pdfCompliance" => "pdfA1b",
        "file" => 'myPdf.pdf'
    ]);
    
    
   
// writing validation to console
echo $res["pdfValidation"];
# /validateDocument# /

# setup the pdfA_client
pdfA_client = PdfAClient(pdf4me_client)

# validate pdf with pdf_compliance specification
validate = pdfA_client.validate_document(
    pdf_compliance='pdfA1b',
    file=FileReader().get_file_handler(path='myPdf.pdf')
)

# extracting the pdfvalidation
print(validate)

Models

Validate

Name Type Description Notes
document Document
validateAction ValidateAction
jobId String [optional]
jobIdExtern String [optional]
integrations [String] [optional]

ValidateAction

Name Type Description Notes
pdfConformance String Type of Pdf compliance Validation. eg: PdfA1 [Optional]

ValidateRes

Name Type Description Notes
document Document PdfA validated document.

Document

Name Type Description Notes
jobId String JobId of Documents WorkingSet.
documentId String Document Id
name String Filename inlcuding filetype.
docStatus String Status of the Document, e.g. Stamped.
pages Page Description of pages.
docData [byte] Document bytes.
docMetadata DocMetadata Document metadata such as title, pageCount et al.
docLogs DocLog Logging information about the request, e.g. timestamp.

Page

Name Type Description Notes
documentId String Globally unique Id.
pageId String Globally unique Id.
pageNumber Integer PageNumber, starting with 1.
rotate double By how much the page was rotated from its original orientation.
thumbnail byte Thumbnail representing this particular page.
sourceDocumentId String Id of the document it was created from, e.g. in case of an extraction, the result's sourceDocumentId is the Id of the PDF the pages have been extracted from.
sourcePageNumber Integer Page number of the original page in the original document, e.g. let's assume document B consists of page number 4 of document A (extraction).
Thus, document B's only page's sourcePageNumber is number 4.

DocMetadata

Name Type Description Notes
title String Title of document.
subject String Subject of document.
pageCount long Number of pages.
size long Number bytes of the document.
isEncrypted boolean If the document is Encrypted
pdfCompliance String Pdf Compliance, e.g. PDF/A.
isSigned boolean If the document is Encrypted
uploadedMimeType String Uploaded MimeType, e.g. application/bson.
uploadedFileSize long Uploaded file size.

DocLog

Name Type Description Notes
messageType String MessageType, e.g. PdfALog.
message String Message itself, e.g. a warning.
timestamp dateTime Timestamp.
docLogLevel String Type of message. Supported Values :
"verbose", "info", "warning", "error", "timing"
durationMilliseconds long Timing for requested log information [ms].

How can we help?