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
// Printing the result | |
Console.WriteLine("Documents: " + result.DocumentCount); | |
Console.WriteLine("Total occurrences: " + result.OccurrenceCount); | |
for (int i = 0; i < result.DocumentCount; i++) | |
{ | |
FoundDocument document = result.GetFoundDocument(i); | |
Console.WriteLine("Document: " + document.DocumentInfo.FilePath); | |
Console.WriteLine("Occurrences: " + document.OccurrenceCount); | |
for (int j = 0; j < document.FoundFields.Length; j++) |
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
// Printing Search Results === | |
for (int i = 0 ; i < result.getDocumentCount(); i++) | |
{ | |
FoundDocument document = result.getFoundDocument(i); | |
// Printing Search Results =========== | |
System.out.println("Occurrences: " + document.getOccurrenceCount()); | |
for (FoundDocumentField field : document.getFoundFields()) { | |
System.out.println("\tField: " + field.getFieldName()); |
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
// Read Dublin Core metadata using Java | |
try (Metadata metadata = new Metadata("path/ebook.epub")) { | |
EpubRootPackage root = metadata.getRootPackageGeneric(); | |
System.out.println(root.getDublinCorePackage().getRights()); | |
System.out.println(root.getDublinCorePackage().getPublisher()); | |
System.out.println(root.getDublinCorePackage().getTitle()); | |
System.out.println(root.getDublinCorePackage().getCreator()); | |
System.out.println(root.getDublinCorePackage().getLanguage()); | |
System.out.println(root.getDublinCorePackage().getDate()); |
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
// Read Dublin Core metadata using C# | |
using (Metadata metadata = new Metadata("path/ebook.epub")) | |
{ | |
var root = metadata.GetRootPackage<EpubRootPackage>(); | |
Console.WriteLine(root.DublinCorePackage.Rights); | |
Console.WriteLine(root.DublinCorePackage.Publisher); | |
Console.WriteLine(root.DublinCorePackage.Title); | |
Console.WriteLine(root.DublinCorePackage.Creator); | |
Console.WriteLine(root.DublinCorePackage.Language); |
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
// Edit PPT/PPTX presenatations in Java using GroupDocs presentation editing and automation API | |
// Load Presentation | |
PresentationLoadOptions loadOptions = new PresentationLoadOptions(); | |
loadOptions.setPassword("P@$$w0Rd"); | |
// Edit Presentation | |
Editor editor = new Editor(new FileInputStream("path/presentation.pptx"), loadOptions); | |
PresentationEditOptions editOptions = new PresentationEditOptions(); | |
editOptions.setSlideNumber(0); //1st slide |
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
// Edit PPT/PPTX presenatations in C# using GroupDocs presentation editing and automation API | |
using (FileStream fs = File.OpenRead("path/presentation.pptx")) | |
{ | |
// Load Presentation | |
Options.PresentationLoadOptions loadOptions = new PresentationLoadOptions(); | |
loadOptions.Password = "P@$$w0Rd"; | |
// Edit Presentation | |
using (Editor editor = new Editor(delegate { return fs; }, delegate { return loadOptions; })) | |
{ |
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
// Change Appearance of QR code in C# | |
// Setting background color, forecolor, transparency, etc. | |
Background = new Background() | |
{ | |
Color = Color.Black, | |
Transparency = 0.5 | |
}, | |
//set text color and Font | |
ForeColor = Color.White |
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
// Apply Image Watermark to specific page(s) of Word file using Java | |
Watermarker watermarker = new Watermarker("path/document.docx"); | |
ImageWatermark watermark = new ImageWatermark("path/watermark-logo.png"); | |
watermark.setOpacity(0.7); | |
watermark.setHorizontalAlignment(HorizontalAlignment.Center); | |
watermark.setVerticalAlignment(VerticalAlignment.Center); | |
// Add watermark to the last page | |
WordProcessingContent content = watermarker.getContent(WordProcessingContent.class); |
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
// Add Watermark Image to specific page(s) of Word document using C# | |
using (Watermarker watermarker = new Watermarker("path/multipage-document.docx")) | |
{ | |
ImageWatermark watermark = new ImageWatermark("path/image.png") | |
{ | |
Opacity = .5, | |
HorizontalAlignment = HorizontalAlignment.Center, | |
VerticalAlignment = VerticalAlignment.Center | |
}; |
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
/* | |
* Update password of the protected spreadsheet files using Java | |
*/ | |
LoadOptions loadOptions = new LoadOptions("mySECRETpassWORD"); | |
UpdatePasswordOptions updateOptions = new UpdatePasswordOptions("TOPSECRET_pa22WORD"); | |
Merger merger = new Merger("path/protected-spreadsheet.xlsx", loadOptions); | |
merger.updatePassword(updateOptions); | |
merger.save("path/pwd-changed-spreadsheet.xlsx"); |