Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
import static java.lang.System.getenv;

/**
* Example of extracting first page from PDF and then chaining conversion PDF page to JPG.
* https://www.convertapi.com/pdf-to-extract
* Example of converting the first page of a PDF to a JPG thumbnail.
* https://www.convertapi.com/pdf-to-jpg
*/
public class CreatePdfThumbnail {
Expand All @@ -26,15 +25,9 @@ public static void main(String[] args) throws IOException, ExecutionException, I

System.out.println("Creating PDF thumbnail");

CompletableFuture<ConversionResult> pdfFirstPageResult = ConvertApi.convert("pdf", "extract",
new Param("file", Paths.get("files/test.pdf")),
new Param("pagerange", "1")
);

CompletableFuture<ConversionResult> thumbnailResult = ConvertApi.convert("pdf", "jpg",
new Param("file", pdfFirstPageResult),
new Param("scaleimage", "true"),
new Param("scaleproportions", "true"),
new Param("file", Paths.get("files/test.pdf")),
new Param("pagerange", "1"),
new Param("imageheight", 300)
);

Expand Down
Loading