Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

io.github.kmozsi:convertapi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io.github.kmozsi:convertapi

The ConvertAPI helps converting various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files. And many others files manipulations. In just few minutes you can integrate it into your application and use it easily. The ConvertAPI client library makes it easier to use the Convert API from your Java 8 projects without having to build your own API calls.

  • 24.0
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

ConvertAPI Java Client

Convert your files with our online file conversion API

The ConvertAPI helps converting various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files. And many others files manipulations. In just few minutes you can integrate it into your application and use it easily.

The ConvertAPI-Java library makes it easier to use the Convert API from your Java 8 projects without having to build your own API calls. You can get your free API secret at https://www.convertapi.com/a

Installation

Download latest JAR file and place it in your project library directory.

Usage

Configuration

You can get your secret at https://www.convertapi.com/a

Config.setDefaultSecret("your-api-secret");

File conversion

Example to convert DOCX file to PDF. All supported formats and options can be found here.

CompletableFuture<ConversionResult> result = ConvertApi.convert("docx", "pdf", new Param("file", Paths.get("test.docx")));

// save to file
result.get().saveFile(Paths.get("my_file.pdf")).get();

Other result operations:

// save all result files to folder
result.get().saveFiles(Paths.get("/tmp"));

// get result file
ConversionResultFile file = result.get().getFile(0);

// get conversion cost
Integer cost = result.get().conversionCost();
Convert file url
CompletableFuture<ConversionResult> result = ConvertApi.convert("pptx", "pdf",
    new Param("file", "https://cdn.convertapi.com/cara/testfiles/presentation.pptx")
);
Additional conversion parameters

ConvertAPI accepts extra conversion parameters depending on converted formats. All conversion parameters and explanations can be found here.

CompletableFuture<ConversionResult> result = ConvertApi.convert("pdf", "jpg",
        new Param("file", Paths.get("test.pdf")),
        new Param("scaleimage", "true"),
        new Param("scaleproportions", "true"),
        new Param("imageheight", 300)
);

User information

You can always check remaining seconds amount by fetching user information.

User user = ConvertApi.getUser();
int secondsLeft = user.SecondsLeft;

More examples

You can find more advanced examples in the examples folder.

Converting your first file, full example:

ConvertAPI is designed to make converting file super easy, the following snippet shows how easy it is to get started. Let's convert WORD DOCX file to PDF:

import com.convertapi.ConvertApi;

public class SimpleConversion {
    public static void main(String[] args) {
        ConvertApi.convertFile("source.docx", "result.pdf", "your-api-secret");
    }
}

This is the bare-minimum to convert a file using the ConvertAPI client, but you can do a great deal more with the ConvertAPI Java library. Take special note that you should replace your-api-secret with the secret you obtained in item two of the pre-requisites.

Issues & Comments

Please leave all comments, bugs, requests, and issues on the Issues page. We'll respond to your request ASAP!

License

The ConvertAPI Java Library is licensed under the MIT license. Refer to the LICENSE file for more information.

FAQs

Package last updated on 24 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc