Extract TOC from EPUB Documents using GroupDocs.Text for .NET 18.4

GroupDocs.Text for .NETIt gives us immense pleasure to announce the release of version 18.4 of GroupDocs.Text for .NET. The latest version allows extracting the table of contents from the EPUB documents. Furthermore, we have added the feature of detecting media type of .one file. Following sections provide details about the newly added features.

Extracting TOC from EPUB Documents

Using version 18.4, you can now extract TOC from the EPUB documents. To access the TOC, TableOfContents property of EpubPackage class is used. Once you get the TOC from the document, you can access the following properties of TOC items using TableOfContentsItem class:

  • Text – the text of the item (usually, it is a chapter’s title)
  • PageIndex – the page index of the text (null if it is just a node without content)
  • Count – the number of sub-items (zero if the item hasn’t sub-items)
  • this[int index] – gets a sub-item
  • ExtractPage – extracts a text of the item

Following code snippet shows how to extract TOC from EPUB document.

// Create a text extractor
using (EpubTextExtractor extractor = new EpubTextExtractor(@"document.epub"))
{
    // Print TOC on the screen
    PrintToc(extractor[0].TableOfContents, 0);
}
 
private static void PrintToc(IEnumerable tableOfContents, int depth)
{
    // Use spaces to indicate the depth of the TOC item
    string spaces = new string(' ', depth);
 
    // Iterate over items
    foreach (TableOfContentsItem item in tableOfContents)
    {
        System.Console.Write(spaces);
        // Print the item's text
        System.Console.Write(item.Text);
 
        // If item has a text (it's not just a node)
        if (item.PageIndex.HasValue)
        {
            // Print the text length
            System.Console.Write(string.Format(" ({0})", item.ExtractPage().Length));
        }
 
        System.Console.WriteLine();
 
        // If the item has children
        if (item.Count > 0)
        {
            // Print them
            PrintToc(item, depth + 1);
        }
    }
}

Media Type Detector for .one Files

This feature allows detecting the media type of OneNote sections using NoteMediaTypeDetector class. Following code snippet shows how to use this feature.

// Create a media type detector
var detector = new NoteMediaTypeDetector();
// Detect a media type by the file name
Console.WriteLine(detector.Detect("section.one");
// Detect a media type by the content
Console.WriteLine(detector.Detect(stream));

GroupDocs.Text for .NET – Available Channels and Resources

Here are a few channels and resources for you to download, learn, try and get technical support on GroupDocs.Text:

Feedback

As always, you are welcome to share your feedback or suggestions to improve this product. Just create a new topic at our forum and our dedicated support team will be there to respond.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Text Product Family | Tagged , , , , | Leave a comment

Indexing of more than 1 TB of Text Documents in GroupDocs.Search for .NET 18.4

GroupDocs.Search for .NETGroupDocs team is pleased to announce the monthly release of version 18.4 of GroupDocs.Search for .NET. Using the latest version, you can now perform indexing of more than 1 TB of text documents. We would recommend you to download the latest version for better user experience.

GroupDocs.Search for .NET API – Enhancements

Support for Indexing of more than 1 TB of Text Documents

Using GroupDocs.Search for .NET version 18.4, you can now implement indexing of text documents of more than 1 TB in size. This enhancement increases the capabilities of API to handle huge text documents.

Available Channels and Resources

Here are a few channels and resources for you to download, try, learn and get technical support on GroupDocs.Search:

Feedback

If you have any suggestions, questions, or queries related to the .NET Search API, we will be happy to hear from you. Just create a forum thread to share your thoughts.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Search Product Family | Tagged , , | Leave a comment

Search Optical Signatures using Java E-Signing API v18.4

GroupDocs.Signature

We are delighted to announce the another monthly release of GroupDocs.Signature for Java v18.4. This release comes up with many features like searching QRCode and Barcode signatures in supported documents. Aside this, few improvements and fixes are also introduced in this version of the API. We would recommend you to download the new version of API and evaluate the exciting features to enhance document e-signing experience.

eSignature API for Java v18.4 – Features

Obtain Search Progress

Obtain search progress while searching signatures in the documents.
Following code sample shows how to obtain search progress:

SignatureHandler handler = new SignatureHandler(signConfig);
handler.SearchStarted.add(new ProcessStartEventHandler() {
	public void invoke(Object sender, ProcessStartEventArgs args) {
        System.out.println("Search started for "+args.getTotalSignatures()+"-page(s) in Document "+args.getGuid()+" started at " +String.valueOf(args.getStarted()));
    }
});		

Search QR-Code and Barcode Signatures

Search QR-Code and Barcode Signatures in following documents:

  • PDF
  • Cells
  • Slides
  • Words
  • Image

Following code sample shows how to search Barcode signature in the PDF document:

PdfSearchBarcodeOptions searchOptions = new PdfSearchBarcodeOptions();
searchOptions.setText("12345678");
// specify text math type
searchOptions.setMatchType(TextMatchType.Contains);
// search document
SearchResult result = handler.search("SignedBarCode.pdf", searchOptions);

Rectangle Property for Radial Gradient Brush

Rectangle property to set borders of ellipse for Radial Gradient Brush is introduced.

Java eSignature API v18.4 – Improvements

  • Separate Brush classes for following brush styles:
  • Update dynamic Metered library with latest changes
  • Mark Brush property as Obsolete
  • e-Signing API for Java 18.4 – Bug Fixes

    • Multiple options on pages setup give duplicate page numbers
    • Result of signing methods when document provided by URL

    Available Channels and Resources

    Here are a few channels and resources for you to learn, try and get technical support on GroupDocs.Signature API for Java:

    Feedback

    As always, you are welcome to share your feedback to improve this product. We will be happy to know your thoughts. Just create a forum thread and our dedicated support team will be there to respond.

    Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
    Posted in GroupDocs.Signature Product Family | Tagged | Leave a comment

    Render Print Area in Worksheets using GroupDocs.Viewer for .NET 18.4

    Document Viewer API

    Here we go! Another monthly release of GroupDocs.Viewer for .NET is out now. In the current release, you will find new options to render print area and to include or exclude hidden columns and rows in the Cells documents. Furthermore, we have added the support of rendering POTX, PPTM, and EPS file formats. Below you find the list of new features, improvements, and fixes added in GroupDocs.Viewer for .NET 18.4.

    .NET Document Rendering API – New Features

    Supported File Formats

    We have added the support of following file formats in this version.

    • POTX (PowerPoint Open XML Presentation Template)
    • PPTM (PowerPoint Open XML Macro-Enabled Presentation)
    • EPS (Encapsulated PostScript)

    Managing Text Overflow when Rendering Cells Documents

    When cells documents are rendered into HTML, overflowed text inside the cell overlays subsequent cells until it meets non-empty cell. To expand the cell width to fit the overflowed text, we have added a new option TextOverflowMode.AutoFitColumn for CellsOptions.TextOverflowMode property of HtmlOptions, ImageOptions or PdfOptions classes. The following code sample shows how to use this feature.

    // Setup GroupDocs.Viewer config
    ViewerConfig config = new ViewerConfig();
    config.StoragePath = @"C:\storage";
       
    // Create html handler
    ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
    string guid = "document.xlsx";
       
    // Set Cells options to hide overflowing text
    HtmlOptions options = new HtmlOptions();
    options.CellsOptions.TextOverflowMode = TextOverflowMode.AutoFitColumn;
      
    // Get pages 
    List pages = htmlHandler.GetPages(guid, options);
       
    foreach (PageHtml page in pages)
    {
        Console.WriteLine("Page number: {0}", page.PageNumber);
        Console.WriteLine("Html content: {0}", page.HtmlContent);
    }

    For more details on this feature, please visit this documentation article.

    Rendering Print Area in Cells Documents

    Starting from 18.4, GroupDocs.Viewer provides a new option RenderPrintAreaOnly in GroupDocs.Viewer.Converter.Options.CellsOptions class which enables rendering sections of the worksheet(s) defined as print area. GroupDocs.Viewer renders each print area in a worksheet as a separate page. The following code sample shows how to use this feature.

    // Setup GroupDocs.Viewer config
    ViewerConfig config = new ViewerConfig();
    config.StoragePath = @"C:\storage";
      
    // Create html handler
    ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
    string guid = "document.xlsx";
      
    // Enable redering of print area
    HtmlOptions options = new HtmlOptions();
    options.CellsOptions.RenderPrintAreaOnly = true;
      
    // Get pages 
    List pages = htmlHandler.GetPages(guid, options);
      
    foreach (PageHtml page in pages)
    {
        Console.WriteLine("Page number: {0}", page.PageNumber);
        Console.WriteLine("Html content: {0}", page.HtmlContent);
    }

    For more details on this feature, please visit this documentation article.

    Rendering Hidden Rows and Columns

    Sometimes cells document may contain hidden columns and rows. By default, hidden columns and rows are not rendered by the API. However, you can now control the inclusion of hidden content in the rendering results using ShowHiddenRows and ShowHiddenColumns properties of GroupDocs.Viewer.Converter.Options.CellsOptions class as shown in the following code sample.

    // Setup GroupDocs.Viewer config
    ViewerConfig config = new ViewerConfig();
    config.StoragePath = @"C:\storage";
      
    // Create html handler
    ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
    string guid = "document.xlsx";
      
    // Enable redering of hidden rows and columns
    HtmlOptions options = new HtmlOptions();
    options.CellsOptions.ShowHiddenRows = true;
    options.CellsOptions.ShowHiddenColumns = true;
      
    // Get pages 
    List pages = htmlHandler.GetPages(guid, options);
      
    foreach (PageHtml page in pages)
    {
        Console.WriteLine("Page number: {0}", page.PageNumber);
        Console.WriteLine("Html content: {0}", page.HtmlContent);
    }

    For more details on this feature, please visit this documentation article.

    Simple File Storage Interface

    Starting from v18.4, GroupDocs.Viewer provides the simple interface IFileStorage to implement custom file storage. This interface is an alternative to complex and overloaded ICacheDataHandler and IInputDataHandler interfaces. For sample implementations of custom file storage, please visit this documentation article.

    Document Viewer API for .NET – Fixes

    Following issues are fixed in version 18.4 of GroupDocs.Viewer for .NET.

    • Invalid PDF when rendering Excel document with multiple pages per sheet
    • DefaultFontName setting is not working for rendering Text documents into PDF and image
    • Incorrect rendering of the content in header and footer of Word document
    • Local links are ignored when rendering PDF to HTML
    • Discrepancy when rendering as JPEG and HTML

    GroupDocs.Viewer for .NET 18.4 – Improvements

    Following are the improvements that we have made in version 18.4.

    • Added prefix for CSS classes when rendering Email messages
    • Minified CSS content when rendering into HTML with EnableMinification is set to true
    • Improved rendering comments from Presentation documents
    • Added support JpegQuality option when rendering Microsoft Project documents
    • Extended support for DefaultFontName setting to PDF documents when rendering into HTML
    • Responsive HTML output required in the case of HTML representation

    Related Links and Resources

    We have a few channels and resources for you to download, learn, try and get technical support on document viewer API.

    Feedback

    As always, if you have any questions or suggestions, feel free to write on our forum.

    Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
    Posted in GroupDocs.Viewer Product Family | Tagged , , , , , , | Leave a comment

    Edit Watermark’s Text and Image using GroupDocs.Watermark for Java 18.3

    GroupDocs Watermark for .NETWe are excited to announce that we have released version 18.3 of GroupDocs.Watermark for Java. The latest version supports replacing text and image for the found watermarks across all the supported formats. It also allows editing of the objects that can be considered as the watermark in PDF documents. Following are some salient features of GroupDocs.Watermark for Java 18.3

    Replacing Text and Image for Found Watermarks

    The latest version allows replacing text and image for the found possible watermarks that we get in a search result. Following sections demonstrate how to replace text and image for the found watermarks.

    Replacing Text

    Document doc = Document.load("D:\\input.pptx");
     
    TextSearchCriteria searchCriteria = new TextSearchCriteria("test", false);
    PossibleWatermarkCollection watermarks = doc.findWatermarks(searchCriteria);
    for (PossibleWatermark watermark : watermarks)
    {
        try
        {
            watermark.setText("passed");
        }
        catch (Exception e)
        {
            // Found entity may not support text editing
            // Passed argument can have inappropriate value
            // Process such cases here
        }
    }
     
    doc.save("D:\\output.pptx");
    doc.close();

    Replacing Image

    String imagePath = "D:\\test.png";
    File imageFile = new File(imagePath);
    byte[] imageBytes = new byte[(int)imageFile.length()];
    InputStream imageInputStream = new FileInputStream(imageFile);
    imageInputStream.read(imageBytes);
    imageInputStream.close();
     
    Document doc = Document.load("D:\\input.pdf");
     
    SearchCriteria searchCriteria = new ImageDctHashSearchCriteria("D:\\logo.bmp");
    PossibleWatermarkCollection watermarks = doc.findWatermarks(searchCriteria);
    for (PossibleWatermark watermark : watermarks)
    {
        try
        {
            watermark.setImageData(imageBytes);
        }
        catch (Exception e)
        {
            // Found entity may not support image replacing
            // Passed image can have inappropriate format
            // Process such cases here
        }
    }
     
    doc.save("D:\\output.pdf");
    doc.close();

    For more details on this feature, please visit this documentation article.

    Editing Watermark Objects in PDF Documents

    Replacing Text for Particular Objects

    You can now replace text for the particular XObjects, artifacts and the annotations in a PDF document. Furthermore, replacing text with formatting is also supported. Following sections demonstrate this feature with code samples.

    Replacing Text

    PdfDocument doc = Document.load(PdfDocument.class, "D:\\sample.pdf");
    // Replace text for XObjects
    for (PdfXObject xObject : doc.getPages().get_Item(0).getXObjects())
    {
        if (xObject.getText().contains("Test"))
        {
            xObject.setText("Passed");
        }
    }
    // Replace text for artifacts
    for (PdfArtifact artifact : doc.getPages().get_Item(0).getArtifacts())
    {
        if (artifact.getText().contains("Test"))
        {
            artifact.setText("Passed");
        }
    }   
    
    // Replace text for annotations
    for (PdfAnnotation annotation : doc.getPages().get_Item(0).getAnnotations())
    {
        if (annotation.getText().contains("Test"))
        {
            annotation.setText("Passed");
        }
    }
    doc.save("D:\\output.pdf");
    doc.close();
    

    Replacing Text with Formatting

    PdfDocument doc = Document.load(PdfDocument.class, "D:\\sample.pdf");
    
    // Replace text for XObjects    
    for (PdfXObject xObject : doc.getPages().get_Item(0).getXObjects())
    {
        if (xObject.getText().contains("Test"))
        {
            xObject.getFormattedTextFragments().clear();
            xObject.getFormattedTextFragments().add("Passed", new Font("Calibri", 19, FontStyle.Bold), Color.getRed(), Color.getAqua());
        }
    }
    // Replace text for artifacts
    for (PdfArtifact artifact : doc.getPages().get_Item(0).getArtifacts())
    {
        if (artifact.getText().contains("Test"))
        {
            artifact.getFormattedTextFragments().clear();
            artifact.getFormattedTextFragments().add("Passed", new Font("Calibri", 19, FontStyle.Bold), Color.getRed(), Color.getAqua());
        }
    }    
    // Replace text for annotations
    for (PdfAnnotation annotation : doc.getPages().get_Item(0).getAnnotations())
    {
        if (annotation.getText().contains("Test"))
        {
            annotation.getFormattedTextFragments().clear();
            annotation.getFormattedTextFragments().add("Passed", new Font("Calibri", 19, FontStyle.Bold), Color.getRed(), Color.getAqua());
        }
    }    
    
    doc.save("D:\\output.pdf");
    doc.close();

    Replacing Image for Particular Objects

    The version 18.3 also supports replacing image for the particular XObjects, artifacts and the annotations as shown in the following code sample.

    String imagePath = "D:\\test.png";
    File imageFile = new File(imagePath);
    byte[] imageBytes = new byte[(int)imageFile.length()];
    InputStream imageInputStream = new FileInputStream(imageFile);
    imageInputStream.read(imageBytes);
    imageInputStream.close();
    
    PdfDocument doc = Document.load(PdfDocument.class, "D:\\sample.pdf");
    
    // Replace image for XObjects
    for (PdfXObject xObject : doc.getPages().get_Item(0).getXObjects())
    {
        if (xObject.getImage() != null)
        {
            xObject.setImage(new PdfWatermarkableImage(imageBytes));
        }
    }    
    // Replace image for artifacts
    for (PdfArtifact artifact : doc.getPages().get_Item(0).getArtifacts())
    {
        if (artifact.getImage() != null)
        {
            artifact.setImage(new PdfWatermarkableImage(imageBytes));
        }
    }
    // Replace image for annotations
    for (PdfAnnotation annotation : doc.getPages().get_Item(0).getAnnotations())
    {
        if (annotation.getImage() != null)
        {
            annotation.setImage(new PdfWatermarkableImage(imageBytes));
        }
    }
    
    doc.save("D:\\output.pdf");
    doc.close();

    For more details on this feature, please visit this documentation article.

    Available Channels and Resources

    Feedback

    As always, if you have any questions or suggestions, feel free to write on our forum.

    Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
    Posted in GroupDocs.Watermark Product Family | Tagged , , , , | Leave a comment

    GroupDocs Newsletter April 2018 – Document Manipulation API Updates and Code Examples

    LinkedIn Google+ Twitter Facebook
    Share this issue:

    Monthly Newsletter

    April 2018

    Java APIs to Add & Remove Watermarks from
    PDF, Microsoft Office, Email and Image File Formats
    Perform complex watermarking operations with simple syntax, easy to use methods and a few lines of code within Java applications.
     
    Java APIs to Add & Remove Watermarks
     

    GroupDocs.Watermark for Java is a powerful document watermarking API to add, search and remove watermarks in popular business and image file formats. The watermarks added by the API are hard to be automatically removed by third-party tools, while it can be easily used for searching and removing previously added watermarks of popular types.

     

    Explore NOWDownload FREE 30-Days Trial

    Available for: .NET

    Product News

    Product News

    Product News
     
    From the Library

    From the Library

    From the Library

     
    Feedback

    Feedback

    Feedback

     
    GroupDocs for .NETGroupDocs for JavaGroupDocs for Cloud APIs
    Product Releases and Updates

    Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
    Posted in Customer Newsletters | Leave a comment

    Edit Watermark Objects in PDF Documents using GroupDocs.Watermark for .NET 18.3

    GroupDocs Watermark for .NETWe are really delighted to announce the release of version 18.3 of GroupDocs.Watermark for .NET. The latest version supports editing of the objects that can be considered as the watermark in PDF documents. Furthermore, the feature of replacing text and image for the found watermarks is also added for all the supported formats. Following are some highlighted features of version 18.3.

    Editing Watermark Objects in PDF Documents

    Replacing Text for Particular Objects

    You can replace text for the particular XObjects, artifacts and the annotations in a PDF document. Furthermore, replacing text with formatting is also supported. Following sections demonstrate this feature with code samples.

    Replacing Text

    using (PdfDocument doc = Document.Load(@"D:\xobjects.pdf"))
    {
        // Replace text for XObjects
        foreach (PdfXObject xObject in doc.Pages[0].XObjects)
        {
            if (xObject.Text.Contains("Test"))
            {
                xObject.Text = "Passed";
            }
        }
        // Replace text for artifacts
        foreach (PdfArtifact artifact in doc.Pages[0].Artifacts)
        {
            if (artifact.Text.Contains("Test"))
            {
                artifact.Text = "Passed";
            }
        }    
    
        // Replace text for annotations
        foreach (PdfAnnotation annotation in doc.Pages[0].Annotations)
        {
            if (annotation.Text.Contains("Test"))
            {
                annotation.Text = "Passed";
            }
        }
        doc.Save(@"D:\output.pdf");
    }

    Replacing Text with Formatting

    using (PdfDocument doc = Document.Load(@"D:\xobjects.pdf"))
    {
        // Replace text for XObjects    
        foreach (PdfXObject xObject in doc.Pages[0].XObjects)
        {
            if (xObject.Text.Contains("Test"))
            {
                xObject.FormattedTextFragments.Clear();
                xObject.FormattedTextFragments.Add("Passed", new Font("Calibri", 19, FontStyle.Bold), Color.Red, Color.Aqua);
            }
        }
        // Replace text for artifacts
        foreach (PdfArtifact artifact in doc.Pages[0].Artifacts)
        {
            if (artifact.Text.Contains("Test"))
            {
                artifact.FormattedTextFragments.Clear();
                artifact.FormattedTextFragments.Add("Passed", new Font("Calibri", 19, FontStyle.Bold), Color.Red, Color.Aqua);
            }
        }
        // Replace text for annotations
        foreach (PdfAnnotation annotation in doc.Pages[0].Annotations)
        {
            if (annotation.Text.Contains("Test"))
            {
                annotation.FormattedTextFragments.Clear();
                annotation.FormattedTextFragments.Add("Passed", new Font("Calibri", 19, FontStyle.Bold), Color.Red, Color.Aqua);
            }
        }
        doc.Save(@"D:\output.pdf");
    }

    Replacing Image for Particular Objects

    The version 18.3 also supports replacing image for the particular XObjects, artifacts and the annotations as shown in the following code sample.

    using (PdfDocument doc = Document.Load(@"D:\xobjects.pdf"))
    {
        // Replace image for XObjects
        foreach (PdfXObject xObject in doc.Pages[0].XObjects)
        {
            if (xObject.Image != null)
            {
                xObject.Image = new PdfWatermarkableImage(File.ReadAllBytes(@"D:\test.png"));
            }
        }
        // Replace image for artifacts
        foreach (PdfArtifact artifact in doc.Pages[0].Artifacts)
        {
            if (artifact.Image != null)
            {
                artifact.Image = new PdfWatermarkableImage(File.ReadAllBytes(@"D:\test.png"));
            }
        }
        // Replace image for annotations
        foreach (PdfAnnotation annotation in doc.Pages[0].Annotations)
        {
            if (annotation.Image != null)
            {
                annotation.Image = new PdfWatermarkableImage(File.ReadAllBytes(@"D:\test.png"));
            }
        }
        doc.Save(@"D:\output.pdf");
    }

    Replacing Text and Image for Found Watermarks

    The latest version allows replacing text and image for the found possible watermarks that we get in a search result. Following sections demonstrate how to replace text and image for the found watermarks.

    Replacing Text

    using (Document doc = Document.Load(@"D:\input.pptx"))
    {
        TextSearchCriteria searchCriteria = new TextSearchCriteria("test", false);
        PossibleWatermarkCollection watermarks = doc.FindWatermarks(searchCriteria);
        foreach (PossibleWatermark watermark in watermarks)
        {
            try
            {
                watermark.Text = "passed";
            }
            catch (Exception e)
            {
                // Found entity may not support text editing
                // Passed argument can have inappropriate value
                // Process such cases here
            }
        }
     
        doc.Save(@"D:\output.pptx");
    }

    Replacing Image

    byte[] imageData = File.ReadAllBytes(@"D:\new_logo.png");
     
    using (Document doc = Document.Load(@"D:\input.pdf"))
    {
        SearchCriteria searchCriteria = new ImageDctHashSearchCriteria(@"D:\logo.bmp");
        PossibleWatermarkCollection watermarks = doc.FindWatermarks(searchCriteria);
        foreach (PossibleWatermark watermark in watermarks)
        {
            try
            {
                watermark.ImageData = imageData;
            }
            catch (Exception e)
            {
                // Found entity may not support image replacing
                // Passed image can have inappropriate format
                // Process such cases here
            }
        }
     
        doc.Save(@"D:\output.pdf");
    }

    For more details on this feature, please visit this documentation article.

    Available Channels and Resources

    Here are a few channels and resources for you to download, learn, try and get technical support on GroupDocs.Watermark:

    Feedback

    As always, we would love to hear your queries and suggestions at our forum.

    Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
    Posted in GroupDocs.Watermark Product Family | Tagged , , , , , | Leave a comment

    Extract Formatted Text from CHM Documents using GroupDocs.Text for .NET 18.3

    GroupDocs.Text for .NETWe keep looking forward to bringing you more features and therefore, we have released version 18.3 of GroupDocs.Text for .NET providing the support of extracting formatted text from CHM documents. The latest version also allows you to extract text by pages and extract table of content from CHM documents. The following sections will provide you the details about the new features of the API.

    Extracting Formatted Text from CHM Documents

    GroupDocs.Text provides a couple of ways to extract formatted text from CHM documents. You can extract the text line by line or as a whole as described below.

    Extracting Line of Characters

    Following code sample shows how to extract a line of characters from a CHM document.

    // Create a text extractor for chm documents
    using (var extractor = new ChmFormattedTextExtractor(stream)) {
      // Extract a line of the text
      string line = extractor.ExtractLine();
      // If the line is null, then the end of the file is reached
      while (line != null) {
        // Print a line to the console
        Console.WriteLine(line);
        // Extract another line
        line = extractor.ExtractLine();
      }
    }

    Extracting all Characters

    Following code sample shows how to extract all characters at once from a CHM document.

    // Create a text extractor for chm documents
    using (var extractor = new ChmFormattedTextExtractor(stream)) {
      // Extract a text
      Console.WriteLine(extractor.ExtractAll());
    }

    You can also use a document formatter to extract text in a particular format. For more details, please visit this documentation article.

    Extracting Text by Pages from CHM Documents

    Using version 18.3, you can also extract text by pages from the CHM documents. For page by page text extraction, we have added the implementation of IPageTextExtractor interface to ChmTextExtractor class. For more details on this feature, please visit this documentation article.

    Extracting TOC from CHM Documents

    We have also added a useful feature of extracting the table of content from CHM documents. To access the TOC, TableOfContents property of ChmTextExtractor class is used. Following code sample shows how to extract the table of content from a CHM document.

    // Create a text extractor
    using (ChmTextExtractor extractor = new ChmTextExtractor(@"C:\Sources\GroupDocs.Text\TestData\unit\chm\VBOB6.CHM"))
    {
        // Print TOC on the screen
        PrintToc(extractor.TableOfContents, 0);
    }
     
    private static void PrintToc(IEnumerable tableOfContents, int depth)
    {
        // Use spaces to indicate the depth of the TOC item
        string spaces = new string(' ', depth);
     
        // Iterate over items
        foreach (TableOfContentsItem item in tableOfContents)
        {
            System.Console.Write(spaces);
            // Print the item's text
            System.Console.Write(item.Text);
     
            // If item has a text (it's not just a node)
            if (item.PageIndex.HasValue)
            {
                // Print the text length
                System.Console.Write(string.Format(" ({0})", item.ExtractPage().Length));
            }
     
            System.Console.WriteLine();
     
            // If the item has children
            if (item.Count > 0)
            {
                // Print them
                PrintToc(item, depth + 1);
            }
        }
    }

    For more details on this feature, please visit this documentation article.

    GroupDocs.Text for .NET – Available Channels and Resources

    Here are a few channels and resources for you to download, learn, try and get technical support on GroupDocs.Text:

    Feedback

    As always, you are welcome to share your feedback or suggestions to improve this product. Just create a new topic at our forum and our dedicated support team will be there to respond.

    Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
    Posted in GroupDocs.Text Product Family | Tagged , , , , | Leave a comment

    Set a Watermark as Background in GroupDocs.Conversion for .NET 18.3

    GroupDocs.Conversion

    Another monthly release of GroupDocs.Conversion for .NET 18.3 is on-board. This release covers some new features, few improvement and a bug fix. API allows developers to set default zoom when converting to Cells, Words and Slides. However, zoom option for PDF conversion is improved, PSD to PDF conversion is improved and XPS to PDF conversion issue is fixed. For further details included in this month’s release, please visit the release notes

    .NET Document Conversion API – Features

    • Set default zoom when converting to Cells, Words and Slides
    • Specific options for converting CSV documents

    New Properties Introduced

    DefaultFont in CellsLoadOptions Class

    var config = new ConversionConfig();
    var conversionHandler = new ConversionHandler(config);
    var loadOptions = new CellsLoadOptions();
    loadOptions.DefaultFont = "Verdana";
    var saveOptions = new PdfSaveOptions();
    var convertedDocument = conversionHandler.Convert("source.xlsx", loadOptions, saveOptions);
    

    Detect page orientation for the supported formats

    var documentInfo = conversionHandler.GetDocumentInfo("source.docx");
    Console.Write(documentInfo.PageOrientation);
    

    Show watermark behind the text

    var saveOptions = new PdfSaveOptions();
    saveOptions.WatermarkOptions.Background = true;
    

    GroupDocs Document Conversion API – Improvements

    • Set zoom when converting to Pdf document
    • Update API for getting document info to detect page orientation for the supported formats
    • Set default font to replace all missing fonts when converting Words and Cells document
    • Conversion improvement when converting Psd and Odg to Pdf

    GroupDocs.Conversion for .NET 18.3 – Bug Fixes

    • XPS to PDF conversion failed

    API Resources

    Here are a few channels and resources for you to download, learn, try and get technical support on GroupDocs.Conversion:

    Feedback

    We always welcome you to share your feedback to improve this product. We will be happy to know your thoughts. Just create a forum thread and our dedicated support team will be there to respond.

    Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
    Posted in GroupDocs.Conversion Product Family | Tagged | Leave a comment

    Encode Custom Object to QR-Code using .NET E-Signing API v18.3

    GroupDocs.Signature

    Team GroupDocs is pleased to announce another monthly release of GroupDocs.Signature for .NET v18.3. This release comes up with few bug fixes and many new features. The main feature introduced is that it allows user to add custom object to QR-Code signatures. We would recommend you to download the new version of API and evaluate the exciting features to enhance document e-signing experience.

    .Net ESignature API v18.3 – New Features

    Encode and Search Custom Object to QR-Code Signature

    Now users of this API can add and search custom object to QR-Code signatures.
    Following code sample shows how to add a custom object to QR-Code signatures:

    // setup custom object instance with required data
    DocumentSignature docSignature = new DocumentSignature()
    {
        ID = Guid.NewGuid().ToString(),
        Author = "Mr.Sherlock",
        Signed = DateTime.Now,
        DataFactor = 0.67M
    };
    // setup sign options
    PdfQRCodeSignOptions signOptions = new PdfQRCodeSignOptions();
    // QR-code type
    signOptions.EncodeType = QRCodeTypes.QR;
    // setup Data property with custom object
    signOptions.Data = docSignature;
    

    Square type for Stamp Signatures

    User can sign documents with stamp signatures either in a square or a round shape.
    Following code sample shows how to sign document with square type stamp signature:

    ImagesStampSignOptions signOptions = new ImagesStampSignOptions();
    // setup stamp type
    signOptions.StampType = StampTypes.Square;
    // sign document with square stamp
    signedPath = handler.Sign("invoice.png", signOptions,
        new SaveOptions { OutputType = OutputType.String, OutputFileName = "DocImages_StampSquare" });
    

    New Slides File Formats

    Following are the new slides file formats introduced in this release of the API:

    • otp
    • potx
    • potm
    • ppsm

    QR-Code Embedded Classes

    New embedded classes introduced for QR-Code are as follow:

    • VCard
    • Email

    e-Signing API for .NET 18.3 – Bug Fixes

    • Signed .doc files have .docx extension and .ppt files have .pps extension

    Available Channels and Resources

    Here are a few channels and resources for you to learn, try and get technical support on GroupDocs.Signature API for .NET:

    Feedback

    As always, you are welcome to share your feedback to improve this product. We will be happy to know your thoughts. Just create a forum thread and our dedicated support team will be there to respond.

    Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
    Posted in GroupDocs.Signature Product Family | Tagged | Leave a comment