File conversion is the process of transforming one data file format into another. This can be done for several reasons, such as to make a document compatible with a different software application or to optimize an image file. Document and image conversion are two of the most common types of format conversions used by application developers. For instance, a developer may convert a JPEG image into a PNG format so that it can be used by a graphics application. Another useful scenario is converting a Microsoft Word (DOC, DOCX) document into PDF format so that it could be viewed by a PDF viewer
Similarly, there are several other document conversion options app developers may use like building a PDF converter application or converting JSON to XLSX format to read the contents of the file in the software they are developing. If you are also looking to accurately transform your multi-format files from one data format to another, you can use the robust, scalable, and user-friendly APIs of GroupDocs.Conversion for .NET and Java platforms. The APIs provide the perfect solutions for developers who want to access and convert a multitude of documents and images easily.
Before diving into the conversions, please review the .NET and Java installation guides to set up your environment correctly.
Let’s take a look at some of the popular use cases for converting your documents, images, ebooks, audio, diagrams, drawings, and numerous other types of files.
PDFs are often created from scanned documents, which means that along with text, they could also contain a lot of images, watermarks, electronic signatures, and much more. So, converting PDFs would be required so that the files can be opened and edited in different programs. You can do this accurately using the conversion features of GroupDocs.Conversion APIs and convert between documents and images in .NET and Java.
// Load the source PDF file using (var converter = new GroupDocs.Conversion.Converter("sample.pdf")) { // Set the convert options for DOCX format var options = new WordProcessingConvertOptions(); // Convert to DOCX format converter.Convert("converted.docx", options); }
// Load the source PDF file using (var converter = new GroupDocs.Conversion.Converter("sample.pdf")) { GroupDocs.Conversion.Contracts.SavePageStream getPageStream = page => new FileStream(string.Format("converted-page-{0}.png", page), FileMode.Create); // Set the convert options for PNG format var options = new ImageConvertOptions { Format = GroupDocs.Conversion.FileTypes.ImageFileType.Png }; // Convert to PNG format converter.Convert(getPageStream, options); }
// Load the source PDF file Converter converter = new Converter("sample.pdf"); // Set the convert options for DOCX format WordProcessingConvertOptions options = new WordProcessingConvertOptions(); // Convert to DOCX format converter.convert("converted.docx", options);
// Load the source PDF file Converter converter = new Converter("sample.pdf"); SavePageStream getPageStream = page => new FileOutputStream(String.format("converted-page-%s.png", page)); // Set the convert options for PNG format var options = new ImageConvertOptions(); options.setFormat(ImageFileType.Png); // Convert to PNG format converter.convert(getPageStream, options);
A simple question asked by many people is: why would I want to convert my image to PDF? The answer is simple; PDFs are universally accepted and readable by all devices and platforms. So if you want your document to be viewed on any device regardless of its operating system, converting your PNG or JPG images to PDF will be the best option for you. Likewise, you might want to convert your PNG or JPG images to Word, Excel, or PowerPoint documents for sharing, editing, printing, or storage of your files with cross-application compatibility in mind. GroupDocs.Conversion APIs for .NET and Java platforms make different types of image conversions easier for you.
Converting specific document pages to PDF is a common need for many organizations considering PDF is a universal file type and can be opened on any device or platform without any hassle. PDFs are also more secure than traditional documents and can preserve the original document formatting, including layout, images, text formatting, and fonts. Another important characteristic of PDFs is the ability to be used as attachments without being compressed or resized. So, if you want to change certain pages within your document to PDF format in .NET or Java, GroupDocs.Conversion APIs equip you with the right toolset for this purpose.
Adding watermarks to the output files during the conversion process could help make the exported documents secure, prevent any misuse, and avoid alterations to the document without the permission of the file owner. GroupDocs.Conversion APIs for .NET and Java let you apply watermarks to different converted data files seamlessly.
using (Converter converter = new Converter("sample.docx")) { WatermarkOptions watermark = new WatermarkTextOptions("Sample watermark") { Color = Color.Red, Width = 100, Height = 100, Background = true }; PdfConvertOptions options = new PdfConvertOptions { Watermark = watermark }; converter.Convert("converted.pdf", options); }
Converter converter = new Converter("sample.docx"); PdfConvertOptions options = new PdfConvertOptions(); WatermarkOptions watermark = new WatermarkOptions(); watermark.setText("Sample watermark"); watermark.setColor(Color.red); watermark.setWidth(100); watermark.setHeight(100); watermark.setBackground(true); options.setWatermark(watermark); converter.convert("converted.pdf", options);