Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Demos/Dropwizard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-annotation</artifactId>
<version>23.6</version>
<version>23.8</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
Expand Down
2 changes: 1 addition & 1 deletion Demos/Spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-annotation</artifactId>
<version>23.6</version>
<version>23.8</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down
2 changes: 1 addition & 1 deletion Examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-annotation</artifactId>
<version>23.6</version>
<version>23.8</version>
</dependency>
</dependencies>
<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,91 +17,92 @@ public static void main(String[] args) throws IOException {
System.out.println("=====================================================");

//NOTE: Please uncomment the example you want to try out

// Quick Start
SetLicenseFromFile.run();
SetLicenseFromStream.run();
// SetMeteredLicense.run();
// SetLicenseFromStream.run();
// SetMeteredLicense.run();

// Get supported file formats
GetSupportedFileFormats.run();
// GetSupportedFileFormats.run();

// Get file info
GetFileInfo.run(Constants.INPUT_PDF);
GetFileInfo.run(Constants.INPUT_DOC);
GetFileInfo.run(Constants.INPUT_CELL);
// GetFileInfo.run(Constants.INPUT_PDF);
// GetFileInfo.run(Constants.INPUT_DOC);
// GetFileInfo.run(Constants.INPUT_CELL);

// Extract annotations from document
ExtractAnnotationsFromDocument.run(Constants.INPUT_PDF);
// ExtractAnnotationsFromDocument.run(Constants.INPUT_PDF);
// ExtractAnnotationsFromDocument.run(Constants.INPUT_DOC);
// ExtractAnnotationsFromDocument.run(Constants.INPUT_CELL);

// Remove annotation from document
// RemoveAnnotationFromDocument.run();

// Generate document pages preview
GenerateDocumentPagesPreview.run(Constants.INPUT_PDF);
// GenerateDocumentPagesPreview.run(Constants.INPUT_PDF);
// GenerateDocumentPagesPreview.run(Constants.INPUT_DOC);
// GenerateDocumentPagesPreview.run(Constants.INPUT_CELL);

// Saving specific page range
SavingSpecificPageRange.run(Constants.INPUT_PDF);
// SavingSpecificPageRange.run(Constants.INPUT_PDF);

// Saving only pages with annotations
SavingOnlyPagesWithAnnotations.run(Constants.INPUT_PDF);
// SavingOnlyPagesWithAnnotations.run(Constants.INPUT_PDF);

// Filtering annotation types
FilteringAnnotationTypes.run(Constants.INPUT_PDF);
// FilteringAnnotationTypes.run(Constants.INPUT_PDF);

// Add area annotation
AddAreaAnnotation.run();
// AddAreaAnnotation.run();

// Add arrow annotation
AddArrowAnnotation.run();
// AddArrowAnnotation.run();

// Add distance annotation
AddDistanceAnnotation.run();
// AddDistanceAnnotation.run();

// Add ellipse annotation
AddEllipseAnnotation.run();
// AddEllipseAnnotation.run();

// Add link annotation
AddLinkAnnotation.run();
// AddLinkAnnotation.run();

// Add point annotation
AddPointAnnotation.run();
// AddPointAnnotation.run();

// Add resources redaction annotation
AddResourcesRedactionAnnotation.run();
// AddResourcesRedactionAnnotation.run();

// Add text highlight annotation
AddTextHighlightAnnotation.run();
// AddTextHighlightAnnotation.run();

// Add text field annotation
AddTextFieldAnnotation.run();
// AddTextFieldAnnotation.run();

// Add text redaction annotation
AddTextRedactionAnnotation.run();
// AddTextRedactionAnnotation.run();

// Add text replacement annotation
AddTextReplacementAnnotation.run();
// AddTextReplacementAnnotation.run();

// Add text strikeout annotation
AddTextStrikeoutAnnotation.run();

// Add polyline annotation
AddPolylineAnnotation.run();
// AddPolylineAnnotation.run();

// Add underline annotation
AddTextUnderlineAnnotation.run();

// Add watermark annotation
AddWatermarkAnnotation.run();
// AddWatermarkAnnotation.run();

// Add replies annotation
AddReplies.run();
// AddReplies.run();

// Remove replies
RemoveReplies.run();
// RemoveReplies.run();

// Remove replies by Id
// RemoveRepliesById.run();
Expand All @@ -110,33 +111,33 @@ public static void main(String[] args) throws IOException {
// RemoveRepliesByUserName.run();

// Update annotation
UpdateAnnotation.run();
// UpdateAnnotation.run();

// Load document from local disk
LoadDocumentFromLocalDisk.run();
// LoadDocumentFromLocalDisk.run();

// Load document from stream
LoadDocumentFromStream.run();
// LoadDocumentFromStream.run();

// Load password-protected documents
LoadPasswordProtectedDocuments.run();
// LoadPasswordProtectedDocuments.run();

// Load document from url
LoadDocumentFromUrl.run();
// LoadDocumentFromUrl.run();

// Load document from FTP
LoadDocumentFromFtp.run();
// LoadDocumentFromFtp.run();

// Load document from AmazonS3
// LoadDocumentFromAmazonS3.run();

// Load document from Azure
// LoadDocumentFromAzure.run();

MinimalAnnotation.run();
// MinimalAnnotation.run();

// AddUserRole.run();

AddUserRole.run();

System.out.println();
System.out.println("All done.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.groupdocs.annotation.examples.basic_usage;

import com.groupdocs.annotation.Annotator;
import com.groupdocs.annotation.models.Point;
import com.groupdocs.annotation.models.Reply;
import com.groupdocs.annotation.models.annotationmodels.StrikeoutAnnotation;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class DevTest {
public static void run() {
// This example demonstrates adding text strikeout annotation.

// Create an instance of Annotator class
Annotator annotator = new Annotator(System.getProperty("user.dir") + "\\Resources\\SampleFiles\\dev_sample.pdf");
try {
// Create an instance of Reply class and add comments
Reply reply1 = new Reply();
reply1.setComment("First comment");
reply1.setRepliedOn(Calendar.getInstance().getTime());

Reply reply2 = new Reply();
reply2.setComment("Second comment");
reply2.setRepliedOn(Calendar.getInstance().getTime());

java.util.List<Reply> replies = new ArrayList<>();
replies.add(reply1);
replies.add(reply2);

Point point1 = new Point(80, 730);
Point point2 = new Point(240, 730);
Point point3 = new Point(80, 650);
Point point4 = new Point(240, 650);

List<Point> points = new ArrayList<>();
points.add(point1);
points.add(point2);
points.add(point3);
points.add(point4);

// Create an instance of StrikeoutAnnotation class and set options
StrikeoutAnnotation strikeout;
strikeout = new StrikeoutAnnotation();
strikeout.setCreatedOn(Calendar.getInstance().getTime());
strikeout.setFontColor(65535);
strikeout.setMessage("This is strikeout annotation");
strikeout.setOpacity(0.7);
strikeout.setPageNumber(0);
strikeout.setPoints(points);
strikeout.setReplies(replies);

// Add annotation and save to file
annotator.add(strikeout);
annotator.save(System.getProperty("user.dir") + "\\Resources\\Output\\dev.pdf");
} finally {
if (annotator != null) {
annotator.dispose();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* </p>
*/
public class AddAreaAnnotation {

public static void run() {
Reply reply1 = new Reply();
reply1.setComment("First comment");
Expand All @@ -32,23 +31,21 @@ public static void run() {

String outputPath = Constants.getOutputFilePath("AddAreaAnnotation", FilenameUtils.getExtension(Constants.INPUT_PDF));

final Annotator annotator = new Annotator(Constants.INPUT_PDF);

AreaAnnotation area = new AreaAnnotation();
area.setBackgroundColor(65535);
area.setBox(new Rectangle(100, 100, 100, 100));
area.setCreatedOn(Calendar.getInstance().getTime());
area.setMessage("This is area annotation");
area.setOpacity(0.7);
area.setPageNumber(0);
area.setPenColor(65535);
area.setPenStyle(PenStyle.DOT);
area.setPenWidth((byte) 3);
area.setReplies(replies);
annotator.add(area);
annotator.save(outputPath);

annotator.dispose();
try(final Annotator annotator = new Annotator(Constants.INPUT_PDF)) {
AreaAnnotation area = new AreaAnnotation();
area.setBackgroundColor(65535);
area.setBox(new Rectangle(100, 100, 100, 100));
area.setCreatedOn(Calendar.getInstance().getTime());
area.setMessage("This is area annotation");
area.setOpacity(0.7);
area.setPageNumber(0);
area.setPenColor(65535);
area.setPenStyle(PenStyle.DOT);
area.setPenWidth((byte) 3);
area.setReplies(replies);
annotator.add(area);
annotator.save(outputPath);
}

System.out.println("\nDocument saved successfully.\nCheck output in " + outputPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void run() {
reply2.setComment("Second comment");
reply2.setRepliedOn(Calendar.getInstance().getTime());

java.util.List<Reply> replies = new ArrayList<Reply>();
java.util.List<Reply> replies = new ArrayList<>();
replies.add(reply1);
replies.add(reply2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void run() {
reply2.setComment("Second comment");
reply2.setRepliedOn(Calendar.getInstance().getTime());

java.util.List<Reply> replies = new ArrayList<Reply>();
java.util.List<Reply> replies = new ArrayList<>();
replies.add(reply1);
replies.add(reply2);

Expand All @@ -39,7 +39,7 @@ public static void run() {
Point point3 = new Point(80, 650);
Point point4 = new Point(240, 650);

List<Point> points = new ArrayList<Point>();
List<Point> points = new ArrayList<>();
points.add(point1);
points.add(point2);
points.add(point3);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.groupdocs.annotation.examples.basic_usage.pdf_components;

import com.groupdocs.annotation.Annotator;
import com.groupdocs.annotation.examples.Constants;
import com.groupdocs.annotation.models.BorderStyle;
import com.groupdocs.annotation.models.Rectangle;
import com.groupdocs.annotation.models.Reply;
import com.groupdocs.annotation.models.formatspecificcomponents.pdf.ButtonComponent;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class AddButtonComponent {
public static void run() {
try(final Annotator annotator = new Annotator(Constants.INPUT_PDF)) {
ButtonComponent buttonComponent = new ButtonComponent();
buttonComponent.setCreatedOn(new Date());
buttonComponent.setStyle(BorderStyle.DASHED);
buttonComponent.setMessage("This is button component");
buttonComponent.setBorderColor(1422623);
buttonComponent.setPenColor(14527697);
buttonComponent.setButtonColor(10832612);
buttonComponent.setPageNumber(0);
buttonComponent.setBorderWidth(12);
buttonComponent.setBox(new Rectangle(100, 300, 90, 30));

Reply reply1 = new Reply();
reply1.setComment("First comment");
reply1.setRepliedOn(new Date());

Reply reply2 = new Reply();
reply2.setComment("Second comment");
reply2.setRepliedOn(new Date());

List<Reply> replies = new ArrayList<>();
replies.add(reply1);
replies.add(reply2);

buttonComponent.setReplies(replies);

annotator.add(buttonComponent);
annotator.save("result_button_component.pdf");
}
}
}
Loading