Created
July 5, 2017 07:10
-
-
Save atirtahirgroupdocs/83198cffebc13d5f28883274bfb56f57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-signature/GroupDocs.Signature-for-Java | |
// setup Signature configuration | |
SignatureConfig signConfig = CommonUtilities.getConfiguration(); | |
// instantiating the conversion handler | |
SignatureHandler<String> handler = new SignatureHandler<String>(signConfig); | |
DocumentDescription docInfo = handler.getDocumentDescription(CommonUtilities.getStoragePath(fileName), ""); | |
System.out.println("Document " + docInfo.getGuid() + " contains " + docInfo.getPageCount() + " pages"); | |
System.out.println("Width of first page is " + docInfo.getPages().get(0).getWidth()) ; | |
// Image from specified page | |
byte[] bytesImage = handler.getPageImage(CommonUtilities.getStoragePath(fileName), 1, null, null, null); | |
InputStream memoryStream = new ByteArrayInputStream(bytesImage); | |
FileOutputStream out = new FileOutputStream(CommonUtilities.getOutputPath("image_from_page.png")); | |
BufferedImage imBuff = ImageIO.read(memoryStream); | |
System.out.println("Height of image is " + imBuff.getHeight()); | |
ImageIO.write(imBuff, "png",out ); | |
memoryStream.close(); | |
// Page size | |
java.awt.Dimension pageSize = handler.getDocumentPageSize(CommonUtilities.getStoragePath(fileName), 1, "", (double)0, (double)0, null); | |
System.out.println("Page size is " + pageSize.getHeight() + " x " + pageSize.getWidth()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment