Created
June 27, 2018 07:02
-
-
Save GroupDocsGists/2e2323685441d3f0666499c9cf20f890 to your computer and use it in GitHub Desktop.
GroupDocs.Watermark for Java 18.6
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-watermark/GroupDocs.Watermark-for-Java | |
WordsDocument doc = Document.load(WordsDocument.class, Common.mapSourceFilePath(FILE_PATH)); | |
TextWatermark watermark = new TextWatermark("Watermark text", new Font("Arial", 19)); | |
watermark.setForegroundColor(Color.getRed()); | |
// Set WordsShapeSettings | |
WordsShapeSettings settings = new WordsShapeSettings(); | |
settings.setLocked(true); | |
settings.setLockType(WordsLockType.AllowOnlyFormFields); | |
settings.setPassword("7654321"); | |
// Add watermark | |
doc.addWatermark(watermark, settings); | |
// Save document | |
doc.save(Common.mapOutputFilePath(FILE_PATH)); | |
doc.close(); |
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-watermark/GroupDocs.Watermark-for-Java | |
WordsDocument doc = Document.load(WordsDocument.class, Common.mapSourceFilePath(FILE_PATH)); | |
TextWatermark watermark = new TextWatermark("Watermark text", new Font("Arial", 19)); | |
watermark.setForegroundColor(Color.getRed()); | |
// Set WordsShapeSettings | |
WordsShapeSettings settings = new WordsShapeSettings(); | |
settings.setPageNumbers(new int[] { 1, 3 }); | |
settings.setLocked(true); | |
settings.setLockType(WordsLockType.AllowOnlyComments); | |
settings.setPassword("7654321"); | |
// Add watermark | |
doc.addWatermark(watermark, settings); | |
// Save document | |
doc.save(Common.mapOutputFilePath(FILE_PATH)); | |
doc.close(); |
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-watermark/GroupDocs.Watermark-for-Java | |
WordsDocument doc = Document.load(WordsDocument.class, Common.mapSourceFilePath(FILE_PATH)); | |
TextWatermark watermark = new TextWatermark("Watermark text", new Font("Arial", 19)); | |
watermark.setForegroundColor(Color.getRed()); | |
// Set WordsShapeSettings | |
WordsShapeSettings settings = new WordsShapeSettings(); | |
settings.setLocked(true); | |
settings.setLockType(WordsLockType.ReadOnlyWithEditableContent); | |
settings.setPassword("7654321"); | |
// Add watermark | |
doc.getSections().get_Item(0).addWatermark(watermark, settings); | |
// Save document | |
doc.save(Common.mapOutputFilePath(FILE_PATH)); | |
doc.close(); |
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-watermark/GroupDocs.Watermark-for-Java | |
WordsDocument doc = Document.load(WordsDocument.class, Common.mapSourceFilePath(FILE_PATH)); | |
doc.protect(WordsProtectionType.ReadOnly, "7654321"); | |
// Save document | |
doc.save(Common.mapOutputFilePath(FILE_PATH)); | |
doc.close(); |
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-watermark/GroupDocs.Watermark-for-Java | |
WordsDocument doc = Document.load(WordsDocument.class, Common.mapSourceFilePath(FILE_PATH)); | |
doc.unprotect(); | |
// Save document | |
doc.save(Common.mapOutputFilePath(FILE_PATH)); | |
doc.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment