Sign document with HIBC PAS barcode Symbology

GroupDocs.Signature provides the HIBCPASData class (package com.groupdocs.signature.domain.extensions.hibcpas) to create HIBC PAS barcode, designed specifically to meet the stringent requirements of the healthcare industry.

Here are the steps how to add HIBC PAS barcode signature into document with GroupDocs.Signature:

  • Create new instance of Signature class and pass source document path as a constructor parameter.
  • Instantiate the HIBCPASData class. Set the data location with the setDataLocation method (a HIBCPASDataLocation constant) and add records with the addRecord method (a HIBCPASDataType constant and the value).
  • Instantiate the QrCodeSignOptions object with all required additional options and pass the HIBCPASData object to its setData method.
  • Call the sign method of the Signature class instance and pass QrCodeSignOptions to it.
  • Analyze the SignResult result to check newly created signatures if needed.

This example shows how to add HIBCPASData signature to document using Java:

Signature signature = new Signature("sample.pdf");
try {
    HIBCPASData data = new HIBCPASData();
    data.setDataLocation(HIBCPASDataLocation.Patient);
    data.addRecord(HIBCPASDataType.LabelerIdentificationCode, "A123");
    data.addRecord(HIBCPASDataType.ManufacturerSerialNumber, "SERIAL123");

    // create options
    QrCodeSignOptions options = new QrCodeSignOptions();
    options.setEncodeType(QrCodeTypes.QR);
    options.setLeft(100);
    options.setTop(100);
    // setup Data property to HIBCPASData instance
    options.setData(data);

    // sign document to file
    SignResult signResult = signature.sign("signed.pdf", options);

    // analyzing result
    System.out.println("List of newly created signatures:");
    int number = 1;
    for (BaseSignature temp : signResult.getSucceeded()) {
        System.out.println("Signature #" + number++ + ": Type: " + temp.getSignatureType()
                + " Id:" + temp.getSignatureId()
                + ", Location: " + temp.getLeft() + "x" + temp.getTop()
                + ". Size: " + temp.getWidth() + "x" + temp.getHeight());
    }
} finally {
    signature.dispose();
}

This example shows how to decode HIBCPASData signature from the document using Java. The getData method of QrCodeSignature takes the class of the expected object:

Signature signature = new Signature("signed.pdf");
try {
    List<QrCodeSignature> signatures = signature.search(QrCodeSignature.class, SignatureType.QrCode);
    if (!signatures.isEmpty()) {
        HIBCPASData data = signatures.get(0).getData(HIBCPASData.class);
        if (data != null) {
            System.out.println("HIBC PAS data location: " + data.getDataLocation());
            for (HIBCPASRecord record : data.getRecords()) {
                System.out.println("\t" + record.getDataType() + " : " + record.getData());
            }
        }
    }
} finally {
    signature.dispose();
}

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online Apps

Along with the full-featured Java library, we provide simple but powerful free online apps.

To generate barcodes and/or sign your files with barcodes for free, you can use the Barcode Generator online app.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the other online apps from the GroupDocs.Signature App Product Family.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.