Signing specific pages in the multipage document
Leave feedback
On this page
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.
Signaturesignature=newSignature("multipage.tiff");try{QrCodeSignOptionsoptions=newQrCodeSignOptions("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
PagesSetuppagesSetup=newPagesSetup();pagesSetup.setPageNumbers(Arrays.asList(1,3));options.setPagesSetup(pagesSetup);// sign document to file
SignResultsignResult=signature.sign(outputFilePath,options);System.out.println("Document signed with "+signResult.getSucceeded().size()+" signatures");System.out.println("List of newly created signatures:");for(BaseSignaturetemp: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: