Viewing CAD Documents

CAD (Computer-Aided Design) files may contain 2D or 3D designs. They are generated by CAD software programs, which can be used to create models or architectural plans. 2D CAD files are often referred to as drawings, while 3D files are often called models, parts, or assemblies.

The AutoCAD is arguably the most prevalent CAD software on the market. It’s used by professionals and hobbyists alike. If you work with CAD, you’re likely to already be familiar with some of AutoCAD’s most common file formats, such as DWG and DXF

Render the CAD Files using GroupDocs.Viewer

The CAD file formats such as .dwg, .dgn, .dxf, .dwf, .ifc and .stl are also included in the wide range of GroupDocs.Viewer API’s supported file formats

Let’s pick a .dwg file and discuss some of the cases to view the using GroupDocs.Viewer API.

When CAD documents are rendered, the size of the rendering result is adjusted by API automatically depending on the size of the initial document.

You can also adjust the size of the resulting document by setting CadOptions in the following way.

  • Create ViewerHandler
  • Create ImageOptions
  • Set ImageOptions.CadOptions.Heightand ImageOptions.CadOptions.Width properties
  • Call GetPages

The Following code sample demonstrates it.

Java guys will write the code like below:

Rendering CAD Model along with Layouts

Representation of a CAD File with non-empty layouts

When CAD documents are rendered, by default we get only Model representation. In order to render Model and all non-empty Layouts within CAD document, the property CadOptions.RenderLayouts of ImageOptions and HtmlOptions is used.

Following are the steps to render all the non-empty layouts along with the Model.

  • Create HtmlOptions/ImageOptions 
  • Set CadOptions.RenderLayouts of HtmlOptions/ImageOptions to true
  • Call GetPages

The following code sample shows how to render layouts along with the Model of a CAD document.

Java guys will write the code like below:

Working with Layers

Using layers in CAD documents is a way of organizing objects in the drawing by associating them with a specific function or a purpose. For example, when we have a complex drawing of the building, all objects can be divided (associated) into several layers – e.g. electrical, water plumbing, furniture, walls and so on. According to your needs, you can temporarily hide or show some of the objects by turning off their layers. GroupDocs.Viewer allows you to get the list of layers from the drawing and supports rendering specified layers.

Getting List of Layers

The following are the steps to get the list of layer names from a CAD document.

  • Create ViewerHandler (ViewerHtmlHandler or ViewerImageHandler)
  • Get document’s information in DocumentInfoContainer object using GetDocumentInfo method
  • Cast the DocumentInfoContainer object returned by GetDocumentInfo with CadDocumentInfoContainer
  • Access each layer using CadDocumentInfoContainer.Layers collection

The following code sample shows how to get the list of the layers in a CAD document.

Java guys will write the code like below:

Rendering Specific Layers

After you have got the list of layers contained in the drawing, you can specify those that you want to render by adding layer names into the CadOptions.Layers property of corresponding RenderOptions (ImageOptions or HtmlOptions). Please note, when you do not specify layers, all layers are rendered. 

The following code sample shows how to render a specific layer of a CAD document.

Java guys will write the code like below:

The complete ready to run code sample is available on GitHub.

Share on FacebookTweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Viewer Product Family | Tagged , , , , , , , , , , | Leave a comment

Retrieve Count of Credits Consumed In GroupDocs.Conversion for .NET

As you know that API already supports metered licensing.
Can we get count of credits consumed?
Yes, we have a good news for you. There is a new method GetConsumptionCredit() implemented in Metered class. This method returns count of credits that are consumed in case of Metered licensing is used.

Following example demonstrates how to retrieve count of credits consumed.

Let’s talk about the new file formats introduced. Most of you might be working with XLAM, an Excel Macro-Enabled Add-In file format. We have added support for this format in GroupDocs.Conversion for .NET 19.6 release. You can now do back and forth conversion to XLAM. This is not it. Conversion from following file extensions to any other supported file format is now possible:

  • MPX
  • JPC
  • DWT
  • JPEF-LS (JIS)

We’ve also improved Diagram to Word conversion.
Moreover, converting a PowerPoint document with black SmartArt text to PDF issue is resolved. Previously, SmartArt text in the resultant document was changed to white text.

With all such features and improvements, why wait to give it a try? Download latest release from here and share your feedback/concerns on our forum.

Share on FacebookTweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Conversion Product Family | Tagged | Leave a comment

Issue with Footnote Number is Resolved

If you worked with earlier versions of the API, you are probably aware that there was issue in footnote number conversion. A Word document with such footnotes was converted to PDF or any other supported file format successfully but the footnote number order was disturbed.

There was one more issue reported in the forum. It was about converting a PowerPoint document with black SmartArt text to PDF. And the SmartArt text in the resultant document was changed to white text.

What else is fixed?

  • Issue with conversion .docx (with table of content) to .html
  • Conversion of .pdf to .png (or .jpeg) with watermark as background
  • Inconsistent conversion from email file formats when converting to Cells
  • Receiving Aspose.Pdf.InvalidValueFormatException when converting a PDF file

In GroupDocs.Conversion for Java 19.6, we have fixed these issues.

Do we have to take any extra step in order to get right output?
No, these were back-end level issues and they have been fixed. That means you just have to write your normal document conversion code.

There are few regular yet helpful improvements:

  • SVG to Slides conversion is improved
  • Set watermark as background when converting to Image format
Lastly, we’ve added a new file format VCF. you can now do conversion from VCF to any other supported file format.

Please download latest release here. Your feedback is very important for us. If you run into issues or have questions while trying out this latest release, post your concerns here.


Share on FacebookTweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Conversion Product Family | Tagged | Leave a comment

Get Image Representation of a Document

Did you ever wish to get image representation of a document? GroupDocs.Merger for Java 19.6 will make your wish come true. This feature is also helpful for front end application development.

Let’s have a look at its implementation.


It will return page number and page stream. Using getPagePreview method you will get list of page image representations for a document of known format. So, source document file format should be specified.
But what will happen if you don’t specify file format or if it is undefined? The good thing is, it will be detected on the fly.

In this release, we introduced/added support for some new file formats:

  • XLT
  • XLTM
  • XLTX
  • TSV
  • LaTex

Let’s now take a overview of improvements introduced:

  • ODP presentations loading is optimized
  • Ability to specify page number for every joining document. These pages will be included to the resultant document

Along with features and improvements we also emphasize on your feedback. Therefore, we’d like to mention some major bug fixes introduced in this release.

MovePage method was not working accurately for EPUB and EPS formats. This issue is now resolved.
Issue in saving and loading of LaTex documents is resolved.

You can download latest version of the API here. Share your feedback or post your queries here.


Share on FacebookTweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Merger Product Family | Tagged | Leave a comment

Export Annotations to TIFF Files

This may be a big news for those who annotate TIFF documents, most of the time. Previously, there was issue with this format. API was throwing exception “Cannot open image file”. But now you can:

  • Import annotations from TIFF file
  • Delete annotations from it
  • Export annotations into it

Moreover, in trial mode you were not able to get document info. This issue is now resolved in GroupDocs.Annotation for .NET 19.6.

Lets see new features introduced:

More Slide Formats
API now supports following new Slide formats:
  • PPTM
  • POTX
  • POTM
  • PPSM
Credit Based Billing
We integrated credit based billing system in GroupDocs.Annotation for .NET 19.6. Each document operation, along with consumed bytes, also consumes one credit. The amount of already used credits can be retrieved through method GetConsumptionCredit in the Metered class:

API version 19.6 is now available for download. Integrate it in your existing or new applications.

Share on FacebookTweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Annotation Product Family | Tagged | Leave a comment

Create Your Source Code Viewer using GroupDocs.Viewer for .NET 19.6

Do you want to view or present the source code files within your .NET application? Do you want to have a single solution for viewing a bunch of programming language file formats? No need to worry because GroupDocs.Viewer for .NET now supports viewing dozens of source code file formats. Just use a single API and you are done!

The latest release of GroupDocs.Viewer for .NET includes the support of popular programming language files and the list includes:

  • ActionScript File (.as)
  • ActionScript File (.as3)
  • Assembly Language Source Code File (.asm)
  • DOS Batch File (.bat)
  • C/C++ Source Code File (.c)
  • C++ Source Code File (.cc)
  • CMake File (.cmake)
  • C++ Source Code File (.cpp)
  • Cascading Style Sheet (.css)
  • C++ Source Code File (.cxx)
  • Patch File (.diff)
  • Ruby ERB Script (.erb)
  • Groovy Source Code File (.groovy)
  • C/C++/Objective-C Header File (.h)
  • Haml Source Code File (.haml)
  • C++ Header File (.hh)
  • Java Source Code File (.java)
  • JavaScript File (.js)
  • JavaScript Object Notation File (.json)
  • LESS Style Sheet (.less)
  • Vim Settings File (.vim)
  • YAML Document (.yaml)
  • Log File (.log)
  • Objective-C Implementation File (.m)
  • Xcode Makefile Script (.make)
  • Markdown Documentation File (.md)
  • ML Source Code File (.ml)
  • Objective-C++ Source File (.mm)
  • PHP Source Code File (.php)
  • Perl Script (.pl)
  • Java Properties File (.properties)
  • Python Script (.py)
  • Ruby Source Code (.rb)
  • reStructuredText File (.rst)
  • Syntactically Awesome
  • StyleSheets File (.sass)
  • Scala Source Code File (.scala)
  • Scheme Source Code File (.scm)
  • Generic Script File (.script)
  • Bash Shell Script (.sh)
  • Standard ML Source Code File (.sml)
  • Structured Query Language Data File (.sql)

So now, you can create your own source code viewer for a wide range of source code file formats using a single and easy to use API. At the moment, all the above-mentioned files will be rendered as the plain text without highlights. However, we are going to provide you the highlighting feature in the upcoming releases very soon.

So why paying for multiple solutions when GroupDocs.Viewer for .NET is providing support for 100+ file formats including a dozen of source code file formats? Download the latest release now and create your own source code viewer. Have a look at the Developer’s Guide for more details. In case you would have any questions or queries, just feel free to have a conversation with us on our forum.

Share on FacebookTweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Viewer Product Family | Tagged , , , , , , , | Leave a comment

Extract Data Fields from the Documents using GroupDocs.Parser Product Family

Hello everyone! I am back with something new and exciting for the developers who use to deal with the automated data extraction from the documents. A few years back, we released GroupDocs.Parser API which aimed to extract the text from various document formats. We kept on adding the features to it and today, it has become a giant API that provides a wide range of features including formatted text extraction, highlighted and structured text extraction, metadata extraction, extraction of images and the list goes on.

In v19.5 of .NET and Java API, we have introduced another much-needed feature of extracting data from the documents. So today, I shall give you an overview of this feature and demonstrate its working using the code samples.

Some document formats, such as PDF, also support adding the data fields into the documents. An example of this is the invoice that is used to record a predefined set of information such as invoice numbers, order number, date, price, etc. Such documents have a predefined format and therefore, we also call them template documents. There might be the case when you want to process all or some of the invoices and extract the desired data from them. In that case, an automated system must be required to do the job with a little effort.

If you are dealing with such a case then no need to worry at all because GroupDocs.Parser now provides this feature. So let’s check out how you could use this feature for extracting data from the template documents such as invoices. To demonstrate this feature, I shall take the following PDF invoice as the input document.

For data extraction, TemplateField and TemplateFieldPosition classes are introduced. The TemplateFieldPosition class defines the data field’s position on the page in the document. At the moment, we have introduced the following position types:

  • Fixed – The position is set by a rectangle.
  • Regex – The position is found by a regular expression.
  • Related – The position is set relative to the related field.

To extract the data fields from the document, we first create a document template which contains the template fields. The template fields are those fields for which you want to extract the values from the document, such as Invoice Number, Order Number, etc. Once the document template is created, it is used to parse the input document using DocumentParser.Default.ParseByTemplate method. Have a look at the following code snippet in which we are extracting data from the data field that contains “Address” in its name.

C#

Java

Apart from extracting by field names, you can also extract the whole data tables. The procedure is the same, except the one thing that is creating TableAreaDetectorParameters and the TemplateTable objects. The TemplateTable object is created using TableAreaDetectorParameters objects that are used to detect the tables in the desired rectangular area. In the end, the TemplateTable is passed to the DocumentTemplate object. Let’s check out how this can be achieved using the code.

C#

Java

Now, you have seen how you can extract the desired data from the document templates. If you want to avail this feature, just download the latest release and for more details, consult the Developer’s Guide of the API. In case you would find anything confusing, just feel free to post it on our forum and we would love to assist you.

Share on FacebookTweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Parser Product Family | Tagged , , , , , , , , | Leave a comment

Watermarking in Word Processing Documents

A watermark in presentation software and word processing is frequently used in a slightly different manner than digital watermarks used in other digital multimedia content. This watermark is often a faded image or text used as a background of a slide or a page. It is meant to enhance, but is not the focal point of the page/slide. Watermarks are sometimes used in the form of a logo, discreetly placed on a slide or page to brand the presentation or document.

How GroupDocs.Watermark Works?

GroupDocs.Watermark is an API for adding watermarks to the documents of different formats. It provides the effective watermarking methods that allow you to add watermarks that are hard to be automatically removed by third-party tools. It also allows you to search and remove previously added watermarks of popular types (including watermarks added by third-party tools) in a document. The API provides straight forward and easy to use set of methods to add, search and remove watermarks in supported file formats. It supports following watermark types.

  • Text watermark
  • Image watermark

Watermarking in Microsoft Word Documents

When adding watermark in Microsoft Word application, it places a shape with appropriate content in section headers. GroupDocs.Watermark API uses the same approach. When calling AddWatermark method of WordsDocument class, the shape is added to a document.

You can also set some additional options when adding shape watermark to a Word document using GroupDocs.Watermark.

The Following code sample demonstrates it.

The code snippet for java guys is given below:

You can see the faded red watermark in the center of the document page like the screenshot given below:

Let’s pick some other cases to see how effectively you can do watermarking in a Word Processing document.

Adding Watermark to a Particular Section

The Microsoft Word allows the user to divide and format the document into multiple sections. Defining sections in the document enables the user to set specific page layout and formatting for different parts of the document. An example of the sections is headers and footers. Headers and footers are used to display text or any graphical object on all the pages.

GroupDocs.Watermark API allows you to add watermark objects in the headers and footers of the page. Adding watermark to a section of a Word document using GroupDocs.Watermark consists of following steps.

  1. Load the document 
  2. Create and initialize watermark object 
  3. Set watermark properties 
  4. Add watermark to the section of the document
  5. Save the document

Following code sample adds watermark to the headers of a particular section.

Java guys will write the code like below:

Locking Watermark in a Document

There might be the case when you need to lock the watermarks in a Word document to restrict the editing. To deal with such cases, the GroupDocs.Watermark provides 5 variants of locking Word document when adding watermark.

  • AllowOnlyRevisions: user can only add revision marks to the document.
  • AllowOnlyComments: user can only modify comments in the document.
  • AllowOnlyFormFields: the document is split into one-page sections and locked section with watermark is added between each two adjacent document sections.
  • ReadOnly: the entire document is read-only.
  • ReadOnlyWithEditableContent: the document is read-only, but all the content except the watermark is marked as editable.

LockType property has been added to WordsShapeSettings class to set any of the above-mentioned lock types. WordsLockType enum in GroupDocs.Watermark.Office.Words namespace is used to define the lock type.

The following code sample shows how to add and lock the watermark in all pages.

Java guys can follow the code as given below:

Removing Watermark from a Particular Section

Removing watermark from a particular section of a Word document using GroupDocs.Watermark consists of following steps.

  1. Load the document 
  2. Create and initialize image/text search criteria  
  3. Find possible watermarks
  4. Remove found watermarks 
  5. Save the document

Following code sample shows how to remove watermark from a particular section.

The code sample for Java users is given below:

The complete ready to run code sample is available on GitHub.

Share on FacebookTweet about this on TwitterShare on LinkedIn
Posted in GroupDocs.Watermark Product Family | Leave a comment