1. GroupDocs Documentation
  2. /
  3. GroupDocs.Comparison Product Family
  4. /
  5. GroupDocs.Comparison for Java
  6. /
  7. Getting Started
  8. /
  9. Comparison Use Cases
  10. /
  11. How to show AutoCad Drawings preview in Kotlin Compose Multiplatform application

How to show AutoCad Drawings preview in Kotlin Compose Multiplatform application

Compose Multiplatform is a UI framework made by Jetbrains to simplify and accelerate desktop application development using Kotlin with a reactive and functional API. That is why this technology is increasing in popularity. Lots of companies start making software using Compose Multiplatform. As well, as for other goals, the framework can be easily used to create software that works with AutoCad drawings. In this situation GroupDocs.Comparison can be very useful to generate previews.

How to generate preview of AutoCad drawing and show it with Kotlin Compose Multiplatform UI framework

To start working with Compose Multiplatform you need to install JetBrains Idea and create new project. To configure GroupDocs.Comparison library just follow steps below

Configuring Comparison library in a project

First of all, add GroupDocs repository to the project

Add GroupDocs repository

Next step is to add required library dependency

The latest version of Comparison library can be found here

Add GroupDocs.Comparison dependency

Preparing project to display AutoCad drawings preview

To display preview we will need to create Composable function and custom resources loader that will allow to load preview image from temporary file. The file is used just to make the example simplest, streams are also available.

In the code above we created base screen layout. There are just few rows columns and variables, you can read about them in Jetpack Compose documentation. One extra thing is resource loader. It just loads resource by its local path, nothing difficult.

Now, it is time to create file chooser dialog.

In the code above we create button by clicking on which will be opened dialog to choose AutoCad drawings file that will be used for generating preview image. The next code shows how easy you can generate preview image for AutoCad drawings or other files

Generating and displaying preview of AutoCad drawings

GroupDocs.Comparison is modern and very powerful library for comparing different types of documents. The library can compare Word and Pdf documents, Excel and PowerPoint Presentations, Photos, Images, AutoCad drawings, Messages, Code files and much more supported file formats. Except comparing functionality the library allows generating document pages previews, analyzing each change and accepting or rejecting them, getting coordinate of each change and so on. In the code below you can see, how easy preview for AutoCad drawings can be generated. All you need is just create Document object passing drawing path or stream and then call generatePreview method with PreviewOptions as an argument. The callback with page number will be called for each page of the document. PreviewOptions has more options, for example, you can change preview format or specify just a few pages numbers so that the callback will be called only for specified pages.

The last thing we need to do is to display preview of AutoCad drawing using resource loader

The preview of AutoCad drawing is displayed only when there is any image in previewPage object. The preview is configured to be scrollable vertically and to fill width horizontally.

Below you can see result application screen. It is made very simple to be easy understandable but the potential of the technology is very high.

Preview of AutoCad drawing file in Kotlin Compose Multiplatform

Get a Free API License

GroupDocs.Comparison library has much more facilities, for example, generating summary page, changing sensitivity of comparison and so on. Lots of them are available only with license. You can get a free temporary license to use the API without any limitations.

Free Online App

We provide not only full-featured Java/Kotlin library but also powerful free applications. You are welcome to compare your DOC or DOCX, XLS or XLSX, PPT or PPTX, PDF, EML, EMLX, MSG, DWG, DXF and other documents with free to use online GroupDocs Comparison Application.

More details

To get more examples of using GroupDocs.Comparison with Java/Kotlin, check our GitHub page. They are completely free to change and use in order to compare AutoCad drawings, photos, Excel, Word, code files, PowerPoint Presentations and much more supported file formats.

To get more details, options, and examples, you can go through the documentation and GitHub repository. Reach us on the forum for your queries.

See also