diff --git a/Dockerfile b/Dockerfile
index add5885..9a301fc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,7 +6,7 @@ ENV GPG_PASSPHRASE=
ARG GIT_EMAIL=
ARG FULL_NAME=
-ARG MAVEN_VERSION=3.9.6
+ARG MAVEN_VERSION=3.9.10
ARG USER_HOME_DIR="/root"
ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
@@ -22,7 +22,7 @@ COPY maven-release.sh /maven-release.sh
# Install Maven, Git and gpg
RUN apk add --no-cache curl tar bash git gnupg openssh
RUN mkdir -p /usr/share/maven && \
- curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && \
+ curl -fsSL https://downloads.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && \
ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
RUN git config --global user.email ${GIT_EMAIL} && \
git config --global user.name ${FULL_NAME}
diff --git a/README.md b/README.md
index 2c1eae4..b9c465d 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ 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 credentials at https://www.convertapi.com/a
+You can get your free API token at https://www.convertapi.com/a/authentication
## Installation
@@ -19,7 +19,7 @@ Add the following dependency to your pom.xml:
com.convertapi.client
convertapi
- 2.11
+ 2.13
```
@@ -27,10 +27,10 @@ Add the following dependency to your pom.xml:
### Configuration
-You can get your credentials at https://www.convertapi.com/a
+You can get your token at https://www.convertapi.com/a/authentication
```java
-Config.setDefaultApiCredentials("your-api-secret");
+Config.setDefaultApiCredentials("api-token");
```
### File conversion
@@ -111,13 +111,13 @@ import com.convertapi.ConvertApi;
public class SimpleConversion {
public static void main(String[] args) {
- ConvertApi.convert("source.docx", "result.pdf", "your-api-credentials");
+ ConvertApi.convert("source.docx", "result.pdf", "api-token");
}
}
```
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-credentials` with the secret you obtained in item two of the pre-requisites.
+Take special note that you should replace `api-token` with the token 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!
diff --git a/examples/pom.xml b/examples/pom.xml
index b5401d2..17c7301 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -15,7 +15,7 @@
com.convertapi.client
convertapi
- 2.11
+ 2.12
diff --git a/examples/src/main/java/com/convertapi/examples/Advanced.java b/examples/src/main/java/com/convertapi/examples/Advanced.java
index afeb269..c85477c 100644
--- a/examples/src/main/java/com/convertapi/examples/Advanced.java
+++ b/examples/src/main/java/com/convertapi/examples/Advanced.java
@@ -21,7 +21,7 @@
public class Advanced {
public static void main(String[] args) throws ExecutionException, InterruptedException {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
// Advanced HTTP client setup
Config.setDefaultHttpBuilder(builder -> {
diff --git a/examples/src/main/java/com/convertapi/examples/ConversionChaining.java b/examples/src/main/java/com/convertapi/examples/ConversionChaining.java
index f41e3f4..53ff39c 100644
--- a/examples/src/main/java/com/convertapi/examples/ConversionChaining.java
+++ b/examples/src/main/java/com/convertapi/examples/ConversionChaining.java
@@ -21,7 +21,7 @@
public class ConversionChaining {
public static void main(String[] args) throws IOException, ExecutionException, InterruptedException {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
System.out.println("Converting PDF to JPG and compressing result files with ZIP");
CompletableFuture jpgResult = ConvertApi.convert("docx", "jpg", new Param("file", Paths.get("files/test.docx")));
diff --git a/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java b/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java
index 37c2a38..bcffc08 100644
--- a/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java
+++ b/examples/src/main/java/com/convertapi/examples/ConvertRemoteFile.java
@@ -20,7 +20,7 @@
public class ConvertRemoteFile {
public static void main(String[] args) throws ExecutionException, InterruptedException {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
System.out.println("Converting remote PPTX to PDF");
CompletableFuture result = ConvertApi.convert("pptx", "pdf",
diff --git a/examples/src/main/java/com/convertapi/examples/ConvertStream.java b/examples/src/main/java/com/convertapi/examples/ConvertStream.java
index da392bb..a261c2d 100644
--- a/examples/src/main/java/com/convertapi/examples/ConvertStream.java
+++ b/examples/src/main/java/com/convertapi/examples/ConvertStream.java
@@ -22,19 +22,19 @@
public class ConvertStream {
public static void main(String[] args) throws ExecutionException, InterruptedException, IOException {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
// Creating file data stream
- InputStream stream = Files.newInputStream(new File("src/main/resources/test.docx").toPath());
-
- System.out.println("Converting stream of DOCX data to PDF");
- CompletableFuture result = ConvertApi.convert("docx", "pdf",
+ try (InputStream stream = Files.newInputStream(new File("src/main/resources/test.docx").toPath())) {
+ System.out.println("Converting stream of DOCX data to PDF");
+ CompletableFuture result = ConvertApi.convert("docx", "pdf",
new Param("file", stream, "test.docx")
- );
+ );
- Path pdfFile = Paths.get(System.getProperty("java.io.tmpdir") + "/myfile.pdf");
- result.get().saveFile(pdfFile).get();
+ Path pdfFile = Paths.get(System.getProperty("java.io.tmpdir") + "/myfile.pdf");
+ result.get().saveFile(pdfFile).get();
- System.out.println("PDF file saved to: " + pdfFile.toString());
+ System.out.println("PDF file saved to: " + pdfFile.toString());
+ }
}
}
diff --git a/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java b/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java
index ad35ca1..6bdaa81 100644
--- a/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java
+++ b/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java
@@ -20,7 +20,7 @@
public class ConvertWebToPdf {
public static void main(String[] args) throws ExecutionException, InterruptedException {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
System.out.println("Converting WEB to PDF");
CompletableFuture result = ConvertApi.convert("web", "pdf",
diff --git a/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java b/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java
index f7c8f14..ff4c656 100644
--- a/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java
+++ b/examples/src/main/java/com/convertapi/examples/ConvertWordToPdfAndPng.java
@@ -23,7 +23,7 @@
public class ConvertWordToPdfAndPng {
public static void main(String[] args) throws IOException, ExecutionException, InterruptedException {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
System.out.println("Converting DOCX to PDF and JPG in parallel");
diff --git a/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java b/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java
index ddca452..65d3ecf 100644
--- a/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java
+++ b/examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java
@@ -21,7 +21,7 @@
public class CreatePdfThumbnail {
public static void main(String[] args) throws IOException, ExecutionException, InterruptedException {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
System.out.println("Creating PDF thumbnail");
diff --git a/examples/src/main/java/com/convertapi/examples/SimpleConversion.java b/examples/src/main/java/com/convertapi/examples/SimpleConversion.java
index 97b290d..befbbd1 100644
--- a/examples/src/main/java/com/convertapi/examples/SimpleConversion.java
+++ b/examples/src/main/java/com/convertapi/examples/SimpleConversion.java
@@ -11,7 +11,7 @@
public class SimpleConversion {
public static void main(String[] args) {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
String resourcePath = "files/test.docx";
String tmpDir = System.getProperty("java.io.tmpdir") + "/";
diff --git a/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java b/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java
index 22d0498..7da120c 100644
--- a/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java
+++ b/examples/src/main/java/com/convertapi/examples/SplitAndMergePdf.java
@@ -21,7 +21,7 @@
public class SplitAndMergePdf {
public static void main(String[] args) throws IOException, ExecutionException, InterruptedException {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
System.out.println("Creating PDF with the first and the last pages");
diff --git a/examples/src/main/java/com/convertapi/examples/UserInformation.java b/examples/src/main/java/com/convertapi/examples/UserInformation.java
index c09a38e..93e5c01 100644
--- a/examples/src/main/java/com/convertapi/examples/UserInformation.java
+++ b/examples/src/main/java/com/convertapi/examples/UserInformation.java
@@ -13,7 +13,7 @@
public class UserInformation {
public static void main(String[] args) {
- Config.setDefaultApiCredentials(getenv("CONVERTAPI_CREDENTIALS")); //Get your api credentials at https://www.convertapi.com/a
+ Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication
User user = ConvertApi.getUser();
System.out.println("API Key: " + user.ApiKey);
diff --git a/maven-release.sh b/maven-release.sh
index 2fac3bc..06f249c 100644
--- a/maven-release.sh
+++ b/maven-release.sh
@@ -17,10 +17,10 @@ git fetch
git checkout $branch_to_release
echo "Preparing release..."
-mvn release:prepare -DreleaseVersion=${VERSION} -DdevelopmentVersion=${NEXT_VERSION} -Dtag=v${VERSION} -Dresume=false -Darguments=-Dgpg.passphrase=${GPG_PASSPHRASE}
+mvn release:prepare -Prelease-sign-artifacts -DreleaseVersion=${VERSION} -DdevelopmentVersion=${NEXT_VERSION} -Dtag=v${VERSION} -Dresume=false -Darguments=-Dgpg.passphrase=${GPG_PASSPHRASE}
echo "Performing release..."
-mvn release:perform
+mvn release:perform -Prelease-sign-artifacts
echo "Push the new release tag..."
git push --tags
diff --git a/pom.xml b/pom.xml
index cd8e03c..57699e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,13 +4,13 @@
convertapi
jar
- 2.11-SNAPSHOT
+ 2.14-SNAPSHOT
ConvertAPI Java Client
- 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.
+ The ConvertAPI helps to convert 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.
+ And many others file 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.
@@ -71,12 +71,12 @@
com.google.code.gson
gson
- 2.8.9
+ 2.11.0
com.squareup.okhttp3
okhttp
- 4.9.2
+ 4.12.0
@@ -95,7 +95,7 @@
org.apache.maven.plugins
maven-jar-plugin
- 2.1
+ 3.4.2
@@ -107,7 +107,7 @@
maven-deploy-plugin
- 2.8.2
+ 3.1.3
default-deploy
@@ -122,7 +122,7 @@
org.apache.maven.plugins
maven-release-plugin
- 2.5.3
+ 3.1.1
true
false
@@ -133,7 +133,7 @@
org.apache.maven.scm
maven-scm-provider-gitexe
- 1.9.5
+ 2.1.0
@@ -141,7 +141,7 @@
org.sonatype.plugins
nexus-staging-maven-plugin
- 1.6.7
+ 1.7.0
true
ossrh
@@ -153,7 +153,7 @@
org.apache.maven.plugins
maven-source-plugin
- 3.1.0
+ 3.3.1
attach-sources
@@ -167,7 +167,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.1.1
+ 3.10.0
attach-javadocs
@@ -193,12 +193,15 @@
true
+
+ false
+
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
+ 3.2.5
sign-artifacts
diff --git a/src/main/java/com/convertapi/client/RequestBodyStream.java b/src/main/java/com/convertapi/client/RequestBodyStream.java
index 1e617d0..dbf44aa 100644
--- a/src/main/java/com/convertapi/client/RequestBodyStream.java
+++ b/src/main/java/com/convertapi/client/RequestBodyStream.java
@@ -19,15 +19,6 @@ public MediaType contentType() {
return mediaType;
}
- @Override
- public long contentLength() {
- try {
- return inputStream.available();
- } catch (IOException e) {
- return 0;
- }
- }
-
@Override
public void writeTo(BufferedSink sink) throws IOException {
Source source = null;