Last active
December 15, 2018 13:08
-
-
Save groupdocscloud/dd069ea3659b158b48e2239356aea189 to your computer and use it in GitHub Desktop.
This Gist contains examples of GroupDocs.Annotation Cloud SDK for Java
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
Annotation-Java |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
ImagePagesApi apiInstance = Utils.getImagePagesApiInstance(); | |
// create request instance | |
DeletePagesRequest request = new DeletePagesRequest(); | |
request.setName("one-page-annotated.pdf"); | |
request.setFolder("annotationdocs"); | |
// Call api with request | |
File response = apiInstance.deletePages(request); | |
// Get and write output | |
System.out.println("Previously generated images for document pages deleted: " + response.getName()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} | |
} |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
AnnotationApi apiInstance = Utils.getAnnotationApiInstance(); | |
// create request instance | |
DeleteCleanDocumentRequest request = new DeleteCleanDocumentRequest(); | |
request.setName("one-page-annotated.pdf"); | |
request.setFolder("annotationdocs"); | |
request.setPassword(""); | |
// Call api with request | |
File response = apiInstance.deleteCleanDocument(request); | |
// Get and write output | |
System.out.println("Annotations removed from document: " + response.getName()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} | |
} |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
AnnotationApi apiInstance = Utils.getAnnotationApiInstance(); | |
// create request instance | |
GetImportRequest request = new GetImportRequest(); | |
request.setName("one-page-annotated.pdf"); | |
request.setFolder("annotationdocs"); | |
request.setPassword(""); | |
// Call api with request | |
List<AnnotationInfo> response = apiInstance.getImport(request); | |
// Get and write output | |
System.out.println("Annotations count: " + response.size()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} | |
} |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
ImageInfoApi apiInstance = Utils.getImageInfoApiInstance(); | |
// create request instance | |
GetInfoRequest request = new GetInfoRequest(); | |
request.setName("Annotated.pdf"); | |
request.setFolder(""); | |
request.setPassword(""); | |
// Call api with request | |
DocumentInfo response = apiInstance.getInfo(request); | |
// Get and write output | |
System.out.println("DocumentInfo: " + response.getName()); | |
System.out.println("DocumentInfo: " + response.getPages().size()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
ImagePagesApi apiInstance = Utils.getImagePagesApiInstance(); | |
// create request instance | |
GetPageRequest request = new GetPageRequest(); | |
request.setName("two-page.docx"); | |
request.setFolder("annotationdocs"); | |
request.setPageNumber(0); | |
// Call api with request | |
ImagePage response = apiInstance.getPage(request); | |
// Get and write output | |
System.out.println("Page number: " + response.getNumber()); | |
System.out.println("Page link: " + response.getLink().getHref()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} | |
} |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
ImagePagesApi apiInstance = Utils.getImagePagesApiInstance(); | |
// create request instance | |
GetPagesRequest request = new GetPagesRequest(); | |
request.setName("two-page.docx"); | |
request.setFolder("annotationdocs"); | |
// Call api with request | |
ImagePages response = apiInstance.getPages(request); | |
// Get and write output | |
System.out.println("Pages count: " + response.getEntries().size()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} | |
} |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
PdfFileApi apiInstance = Utils.getPdfFileApiInstance(); | |
// create request instance | |
GetPdfRequest request = new GetPdfRequest(); | |
request.setName("one-page.docx"); | |
request.setFolder("annotationdocs"); | |
request.setPassword(""); | |
// Call api with request | |
File response = apiInstance.getPdf(request); | |
// Get and write output | |
System.out.println("File Name: " + response.getName()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} | |
} |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
PdfFileApi apiInstance = Utils.getPdfFileApiInstance(); | |
// create request instance | |
GetPdfStreamRequest request = new GetPdfStreamRequest(); | |
request.setName("one-page.docx"); | |
request.setFolder("annotationdocs"); | |
request.setPassword(""); | |
// Call api with request | |
File response = apiInstance.getPdfStream(request); | |
// Get and write output | |
System.out.println("File Name: " + response.getName()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} | |
} |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
ImagePagesApi apiInstance = Utils.getImagePagesApiInstance(); | |
// create request instance | |
PostPagesRequest request = new PostPagesRequest(); | |
request.setName("two-page.docx"); | |
request.setFolder("annotationdocs"); | |
// Call api with request | |
ImagePages response = apiInstance.postPages(request); | |
// Get and write output | |
System.out.println("Pages count: " + response.getEntries().size()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} | |
} |
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
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
// Create and get annotation api instance | |
AnnotationApi apiInstance = Utils.getAnnotationApiInstance(); | |
// create request instance | |
PutExportRequest request = new PutExportRequest(); | |
request.setName("one-page.pdf"); | |
request.setFolder("annotationdocs"); | |
request.setPassword(""); | |
List<AnnotationInfo> annotations = new ArrayList<AnnotationInfo>(); | |
AnnotationInfo textAnnotation = new AnnotationInfo(); | |
textAnnotation.annotationPosition(new Point(852.0, 154.31)); | |
List<AnnotationReplyInfo> replies = new ArrayList<AnnotationReplyInfo>(); | |
AnnotationReplyInfo replyInfo = new AnnotationReplyInfo(); | |
replyInfo.setMessage("reply text"); | |
replyInfo.setRepliedOn(OffsetDateTime.now()); | |
replyInfo.setUserName("Admin"); | |
replies.add(replyInfo); | |
replyInfo = new AnnotationReplyInfo(); | |
replyInfo.setMessage("reply2 text"); | |
replyInfo.setRepliedOn(OffsetDateTime.now()); | |
replyInfo.setUserName("Commentator"); | |
replies.add(replyInfo); | |
textAnnotation.replies(replies); | |
textAnnotation.setBox(new Rectangle(173.29, 154.31, 142.5, 9.0)); | |
textAnnotation.setPageNumber(0); | |
textAnnotation.setSvgPath("[{\"x\":173.2986,\"y\":687.5769},{\"x\":315.7985,\"y\":687.5769},{\"x\":173.2986,\"y\":678.5769},{\"x\":315.7985,\"y\":678.5769}]"); | |
textAnnotation.setType(AnnotationInfo.TypeEnum.TEXT); | |
textAnnotation.setCreatorName("Anonym A."); | |
annotations.add(textAnnotation); | |
request.setBody(annotations); | |
// Call api with request | |
File response = apiInstance.putExport(request); | |
// Get and write output | |
System.out.println("Annotations count: " + response.getName()); | |
System.out.println("Executed Successfully"); | |
} catch (ApiException e) { | |
System.err.println("Exception when calling AnnotationApi"); | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment