Signing specific pages in the multipage document

Base signature options SignOptions has the setPagesSetup method that takes a PagesSetup object, which allows to set up specific page numbers.

This example shows how to sign specific pages in the multipage Tiff document through the list of page numbers passed to PagesSetup.setPageNumbers.

Signature signature = new Signature("multipage.tiff");
try
{
    QrCodeSignOptions options = new QrCodeSignOptions("Patient #36363393. R: No-Issues");
    // set signature position
    options.setLeft(10);
    options.setTop(10);
    // set signature rectangle
    options.setWidth(200);
    options.setHeight(200);
    // specify page numbers which we want to sign
    PagesSetup pagesSetup = new PagesSetup();
    pagesSetup.setPageNumbers(Arrays.asList(1, 3));
    options.setPagesSetup(pagesSetup);

    // sign document to file
    SignResult signResult = signature.sign(outputFilePath, options);
    System.out.println("Document signed with " + signResult.getSucceeded().size() + " signatures");
    System.out.println("List of newly created signatures:");
    for (BaseSignature temp : signResult.getSucceeded())
    {
        System.out.println(temp.getSignatureType() + " at page #" + temp.getPageNumber() + ": Id:" + temp.getSignatureId() + ".");
    }
}
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 sign PDF, Word, Excel, PowerPoint, and other documents you can use the 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.