GroupDocsGists
10/24/2017 - 1:18 PM

Examples-GroupDocs.Annotation.Examples.Java-src-main-java-GroupDocs-Annotation-Examples-Java-AnnotateDocuments-addAnnotationInSlides.java

// For complete examples and data files, please go to https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-Java
try {
	AnnotationConfig cfg = Utilities.getConfiguration();
	AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
	InputStream inputStream = new FileInputStream(Utilities.storagePath + File.separator + fileName);
	List<AnnotationInfo> annotations = new ArrayList<AnnotationInfo>();
	final AnnotationInfo annotationInfo = new AnnotationInfo();
	annotationInfo.setPageNumber(0);
	annotationInfo.setAnnotationPosition(new Point(1, 2));
	annotationInfo.setFieldText("Hello!");
	annotationInfo.setCreatorName("John");
	annotations.add(annotationInfo);
	// Export annotations to Slides document
	InputStream resultStream = annotator.exportAnnotationsToDocument(inputStream, annotations);
	System.out.println(resultStream.available());
	IOUtils.copy(resultStream,
			new FileOutputStream(Utilities.outputPath + File.separator + "slides-annotated.pptx"));
} catch (Exception e) {
	System.out.println("Exception: " + e.getMessage());
	e.printStackTrace();
}