Compare two documents – Control header and footer comparison in C#

Compare two documents but ignore or include header and footer content. Is this what you need in your document comparison application? Then you must try GroupDocs.Comparison for .NET. This back-end API can be implemented in any of your .NET application without any third party tool/software dependency. Those who are already using this API, we have some interesting features and few bug fixes introduced in GroupDocs.Comparison for .NET 19.11.

Set output paper size

A new property PaperSize is introduced in CompareOptions class using that you can adjust paper size of the resultant document (e.g. PaperSize.A4). If you don’t set PaperSize value, output file will has paper size same as target document by default.

Multi comparer for Email and Text formats

API now allows you to compare more than one email and text (target) files.

Comparing multiple text files follow same procedure.

Switch header and footer comparison

A new property HeaderFootersComparison is introduced in CompareOptions class. If you don’t want to compare header/footer of a document, just set this property to false.

Following are some of the main bug fixes introduced in latest release:

  • API is not releasing file handles
  • Incorrect box dimensions and position
  • Exception during comparing PDF-files without license

Get API from download section. Explore developer guide and in case of any issue, post it on forum.

Posted in GroupDocs.Comparison Product Family | Tagged , , , | Leave a comment

Add Point Annotation in Documents using .NET and Java API

As all our records and documentations are facing a digital transformation. It has made it quite necessary for us to have a good knowledge of the tools that may help us in the long run. Annotation is one of those tools which may help you in adding the extra, yet necessary, piece of information into your documents.

Annotation helps readers in understanding the text in a better way. It also helps different people working on the same task to exchange their concerns regarding a piece of information in the document. It assists different users in commenting or replying through annotations to each other. Simply put, annotations have a wide range of utility.

GroupDocs.Annotation For .NET And Java

GroupDocs.Annotation is a powerful tool which helps in improving applications by adding annotation in the documents. It supports a wide range of documents along with the advantage of authorizing the user to annotate the supported formats in the form of textual comments, watermarks, polylines, redactions, highlighted notes, among others. It empowers the users to communicate their concerns and collaborate through comments.

Add Point Annotation In PDF

GroupDocs.Annotation offers multiple features to users. Some of these features include Area, Distance, Point, Polyline, Arrow, TextField, Watermark and Ellipse annotations. However, if you are looking for a way to specify the main text on which you are making the comment without creating any mess on the document, Point feature works the best. It helps you to stick comments to any point in a document without causing any harm to the content. In simple words, if you are looking forward to point a text in the document, you can always use the Point Annotation feature to fulfill your purpose. Some of the properties offered by this feature include Box, PageNumber, Type, CreatedOn and CreatorName.

Following example demonstrates how you can add point annotation into PDF using GroupDocs.Annotation for .NET:

Java developers can add a point annotation into PDF using GroupDocs.Annotation for Java with following line of codes:

Following screenshot shows how the point annotation look likes in resultant document:

Posted in GroupDocs.Annotation Product Family | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Convert a JPEG file to PSD programmatically in C#

You can convert an image file (e.g. JPEG, JPG, PNG) to PSD format and redesign it as per your requirements using GroupDocs.Conversion for .NET. All you have to do is to integrate this DLL in your web, desktop or console application.

Implementation

  • Pass source document path as a constructor parameter to the instance of Converter class
  • Instantiate ImageConvertOptions
  • Specify resultant image format using Format property of ImageConvertOptions class
  • Declare SavePageStream delegate, which should proved a stream where each document page will be stored
  • Call Convert method of Converter class instance and pass the declared SavePageStream delegate and the instance of ImageConvertOptions from the previous two steps

Have a look at the source JPEG file:

Below is the resultant PSD:

Learn more about document conversion to image format in this article. You can download our open-source example project in order to evaluate API features. In case of any issue, post it on forum.

Posted in GroupDocs.Conversion Product Family | Tagged , , , | Leave a comment

Dynamic Insertion of Links to Bookmarks, Cells and Slides using GroupDocs.Assembly 19.11

Document Automation (or document assembly) is widely used by organizations for their reporting services and GroupDocs.Assembly for .NET and Java APIs provide a complete package of features required to build reports dynamically. Keeping the modern trends in mind and to meet the emerging requirements of our customers, we keep introducing the new features. Recently, we have released the v19.11 of our document automation API with quite a useful set of features. So in this article, I’ll give you an overview of what is new in the latest release.

Dynamic Insertion of Links to Bookmarks, Cells and Slides

Hyperlinks in the documents prove to be useful in many cases, for example, adding links to bookmarks in Word documents, adding links to slides within PowerPoint presentations, inserting a link to cell (or a range of cells) in Excel spreadsheets, etc. Therefore, to handle the hyperlinks in the document automation process, we have introduced the dynamic insertion of hyperlinks to:

  • bookmarks for Word Processing documents and emails,
  • cells for Spreadsheet documents, and
  • slides for Presentation documents.

To insert the hyperlinks, the link tag is used which is placed inside the template documents. The following is the syntax for the link tag:

<<link [uri_or_bookmark_expression] [display_text_expression]>>

The uri_or_bookmark_expression in the tag defines a URI or the name of a bookmark within the same document. This expression is mandatory and must return a non-empty value. Whereas, display_text_expression is the text to be displayed for the hyperlink. This expression is optional and in case it is omitted or returns empty, uri_or_bookmark_expression is used as hyperlink’s text.

For more details along with the sample template documents, please visit the following documentation articles:

Code Blocks, Spans and Strikeout Text for Markdown

In the latest version of our document assembly API, we have extended the set of supported Markdown features. From now on, the following Markdown features will be supported when saving assembled Markdown documents to Word Processing formats and saving assembled Word Processing documents and emails to Markdown:

For more details, see how to work with Markdown documents using .NET and Java API.

Alright! So this is it from my side and it’s your turn to check out and use these amazing document assembling features to enhance your document automation process.

You can download our ready-to-run source code examples from the GitHub repository. The details of every feature are available in our documentation and as always, we would love to hear from you on our forum.

Posted in GroupDocs.Assembly Product Family | Tagged , , , , , | Leave a comment

Watermark Password Protected Documents using GroupDocs.Watermark for .NET 19.11

C# .NET Watermarking API

Another month, another release! GroupDocs.Watermark for .NET 19.11 has been released with 4 improvements and 1 bug fix. So in this article, I’ll give you a brief overview of each improvement and fix we have included in the latest release.

First of all, let’s begin with the improvements and then see what has been fixed in v19.11.

Adding Watermark to Password Protected Documents

GroupDocs.Watermark already supports adding watermark to the password protected documents. However, we have improved and simplified the usage of this feature by adding Password property to the common LoadOptions class. This is how you will add watermark to a password protected document using v19.11 or later.

FormatFamily Enum

FormatFamily enumeration has been added toGroupDocs.Watermark.Common namespace to group the supported document formats. The following groups have been made based on the type of the document:

  • Unknown – Unknown file formats.
  • Diagram – Visio formats (VSD, VSDX etc.).
  • Email – Email formats (EML, MSG, etc.).
  • Image – Image formats (PNG, JPG, etc.).
  • MultiframeImage – Multi-frame image formats (TIFF etc.).
  • Pdf – PDF format.
  • Presentation – Presentation formats (PPT, PPTX, etc.).
  • Spreadsheet – Spreadsheet formats (XLS, XLSX, etc.).
  • WordProcessing – Word processing formats (DOC, DOCX, etc.).

MultiframeImageWatermarkOptions Class

We have added the MultiframeImageWatermarkOptions class to manage the watermark options for the supported multi-frame image types. The following code sample demonstrates how to add a watermark to a multi-frame image.

FontNotFoundException Class for PDF Documents

There could be the case when you add a text watermark to a PDF document with a font that is not available/installed at your end. For such a case, we have added the FontNotFoundException class for the exception that is thrown when the requested font is not found.

Bug Fix

In the previous versions of the API, System.NullReferenceException was thrown when finding the possible watermarks in some of the PDF documents. This issue has been resolved and the fix is available in v19.11.

You can visit the documentation to learn more about the GroupDocs.Watermark for .NET API. You can evaluate all the features of the API by downloading or cloning the code examples from the GitHub repository. In case you find some issue, feel free to contact us via our forum.

Posted in GroupDocs.Watermark Product Family | Tagged , , , , , | Leave a comment

Build your full text search solution in C#

There are two main steps to perform or implement full text search.

  • Indexing
  • Search process

Before we leap into the details, let’s get an overview of this technique. Full text search is basically a more advanced way to search a text/query over a collection of documents in a computer. This approach quickly finds all instances of a term and it works by using text indexes.

One of the examples of full text search implementation is in Word processors and text editors. It helps you to find a phrase or word anywhere in the document.

API Usage

GroupDocs.Search for .NET is a full text search, back-end API that can be integrated in any .NET application without any third party tool or software dependency. It allows you to search over a multitude of document formats in your applications. To make it possible to search instantly across thousands of documents, they must be added to the index. All you have to do is to add DLL reference in your project in order to get started.

Indexing

If you are supposed to perform search over a large number of documents with different or same file formats, you need to create an index.

What is an index?

An index possesses scanned text of all the documents. Therefore, when you are going to perform a search operation (search a specific query), only the index is referenced, rather than the text of the original documents.

Index creation

It can be created in memory or on disk. An index created in memory cannot be saved after exiting your program. In contrast, an index created on disk may be loaded in the future to continue working. The following example shows how to create an index on disk.

Perform Search

When documents are indexed, the index is ready to handle search queries. Following types of search queries are supported:

  • Simple
  • Case sensitive
  • Boolean
  • Phrasal
  • Faceted

See complete list in this article.

Lets go through a use-case. Suppose we have multiple documents (Word, PDF, Excel and HTML) and we want to perform a specific search query (search term “video”) over them.

We will get document path and search term occurrences in all the documents available in documentFolder.

Lets generate output HTML with highlighted search results.

As an output, we will get 6 HTML files. Each file will show content of a different document (e.g. excel.xlsx, source.docx, target.docx) with highlighted search term/word. Given below is the output of excel.xlsx and source.docx files.

We have an open-source example project that you can use in order to evaluate API features. Go through the developer guide and if you face any issue, you can post it on forum.

Posted in GroupDocs.Search Product Family | Tagged , , , , | Leave a comment

Create Document Viewer in ASP.NET Core MVC for 140+ File Formats

The online document viewers have become popular after the grown usage of digital documents, especially in the content management systems. The reason behind this popularity is you can view a variety of document formats without purchasing or installing dedicated software programs. Considering the importance of document viewers, I thought to write an article on how to create a universal document viewer in ASP.NET MVC.

We are going to create an ASP.NET MVC document viewer application that will target the .NET Core framework. For the document rendering at the backend, we’ll use GroupDocs.Viewer for .NET API – a powerful document viewer API which supports over 140 document types including PDF, Word, Excel, PowerPoint, Visio, CAD, Outlook, and many other popular formats.

Why .NET Core?

.NET Core is a valuable addition to the .NET ecosystem by Microsoft. It makes it possible to develop cross-platform applications without any additional efforts required by the developers. This is why I have selected .NET Core to be the targetted framework.

Steps to Create Document Viewer in ASP.NET Core

1. Open Visual Studio and start a new project.

2. Select .NET Core from the project types and ASP.NET Core Web Application from templates.

3. Select Web Application (Model-View-Controller) and click Ok button.

4. Install GroupDocs.Viewer from NuGet.

5. Open Views/Home/Index.cshtml file and replace its content with the following:

6. Open Controllers/HomeController.cs and replace the content of the class with the following code.

7. Append the following styles in the wwwroot/css/site.css file.

8. Build the document viewer application and run in your favorite browser.

ASP.NET Core File Viewer

Download ASP.NET MVC Document Viewer

The source code of the ASP.NET MVC document viewer is open source and available for download.

Posted in GroupDocs.Viewer Product Family | Tagged , , , , , , , | Leave a comment

Add arrow annotation in a PDF file using C#

We are living in a paper-less era. Everything in business has gone digital. If you are given a document (e.g. PDF, Word, Presentation) and asked to brief the sales achieved in 2018. What will you do? You will try to highlight or add arrow to the concerned text.

Supported Annotations

Following are the supported annotation types:

  • Area
  • Arrow
  • Distance
  • Ellipse
  • Link
  • Point

See full list of supported annotations in this article and list of supported file formats here.

Implementation

In this post we will see implementation of arrow annotation in a PDF file. Arrow annotation draws an arrow on the document like shown in the picture below.

There is an ability to specify the next properties for ArrowAnnotation type:

  • Box – defines annotation position at document page
  • Opacity – allows to set annotation opacity
  • PenColor – defines frame color
  • PenStyle – defines frame line style (solid, dash, dot etc.)
  • PenWidth –  defines frame line width in pixels

Download our open-source example project to evaluate API features. If you face any issue, raise it on forum.


Posted in GroupDocs.Annotation Product Family | Tagged , | Leave a comment

Convert a PDF document to HTML using C#

Using GroupDocs.Conversion for .NET, it is possible to convert any PDF document to HTML file in C#. Conversion process or feature is not limited to PDF files only. You can convert any supported file format to HTML.
GroupDocs.Conversion for .NET is a back-end API that can be integrated in any (new or existing) .NET application.

Implementation

This API can convert any source document to a markup format which in general is a HTML conformable format.

You can see that sample PDF has some visuals and text. And the resultant HTML covers everything.

You can download our GitHub open-source example project in order to evaluate the API. In case of any issue, you can raise it on forum.

Posted in GroupDocs.Conversion Product Family | Tagged , , | Leave a comment