Skip to content

Instantly share code, notes, and snippets.

GroupDocs GroupDocsGists

Block or report user

Report or block GroupDocsGists

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View listener.cs
var settings = new ConverterSettings
{
Listener = new ConverterListener()
};
View converterlistener.cs
public class ConverterListener : IConverterListener
{
public void Started()
{
Console.WriteLine("Conversion started...");
}
public void Progress(byte current)
{
Console.WriteLine($"... {current} % ...");
}
View SetPDFCompliance.java
final Redactor redactor = new Redactor("Sample.docx");
try
{
// apply redaction
RedactorChangeLog result = redactor.apply(new ExactPhraseRedaction("John Doe", new ReplacementOptions(java.awt.Color.RED)));
if (result.getStatus() != RedactionStatus.Failed)
{
SaveOptions options = new SaveOptions();
options.getRasterization().setEnabled(true); // the same as options.RasterizeToPDF = true;
options.getRasterization().setCompliance(PdfComplianceLevel.PdfA1a); // by default PdfComplianceLevel.Auto or PDF/A-1b
View rawtextclassification.cs
var response = classifier.Classify("Medicine is an important part of our life");
Console.WriteLine(response.BestClassName, response.BestClassProbability);
View ExtractMetadataFromDocumentNew.Java
// Create an instance of Parser class
try (Parser parser = new Parser("sample.docx")) {
// Extract metadata from Word document (.docx)
Iterable<MetadataItem> metadata = parser.getMetadata();
// Check if metadata extraction is supported
if (metadata == null) {
System.out.println("Metadata extraction isn't supported.");
return;
}
// Print metadata
View CheckPrintRestrictionsInPDF.java
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.setStoragePath("c:\\storage");
// Create image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
// Retrieve document information
String guid = "document.pdf";
PdfDocumentInfoContainer documentInfo = (PdfDocumentInfoContainer) imageHandler.getDocumentInfo(guid);
View headerfootercomp.cs
string sourcePath = "source.pdf";
string targetPath = "target.pdf";
string resultPath = "source.pdf";
//do not compare header/footer
CompareOptions compareOptions = new CompareOptions();
compareOptions.HeaderFootersComparison = false;
Comparer comparer = new Comparer(sourcePath);
comparer.Add(targetPath);
View multiemailcomparison.cs
string sourcePath = "source.eml";
string target1Path = "target1.eml";
string target2Path = "target2.eml";
string target3Path = "target3.eml";
string resultPath = "result.eml";
Comparer comparer = new Comparer(sourcePath);
comparer.Add(target1Path);
comparer.Add(target2Path);
comparer.Add(target3Path);
View papersize.cs
string sourcePath = "source.docx";
string targetPath = "target.docx";
string resultPath = "result.docx";
CompareOptions compareOptions = new CompareOptions();
compareOptions.PaperSize = PaperSize.A4;
Comparer comparer = new Comparer(sourcePath);
comparer.Add(targetPath);
comparer.Compare(File.Create(resultPath), new SaveOptions(), compareOptions);
View ExtractMetadataFromDocument_new.cs
Regex pattern = new Regex("author|company", RegexOptions.IgnoreCase);
using (Metadata metadata = new Metadata(@"D:\input.docx"))
{
// This method searches for properties across all metadata packages and works with all supported formats
var properties = metadata.FindProperties(p => pattern.IsMatch(p.Name) || pattern.IsMatch(p.Value.ToString()));
foreach (var property in properties)
{
Console.WriteLine("{0} = {1}", property.Name, property.Value);
You can’t perform that action at this time.