Created
February 9, 2021 04:18
-
-
Save aspose-com-gists/032de2b87650c56a000bbcc55535f8e5 to your computer and use it in GitHub Desktop.
Convert GIF to PDF in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load GIF image | |
com.aspose.imaging.Image image = com.aspose.imaging.Image.load("image.gif"); | |
// Set image options | |
com.aspose.imaging.imageoptions.PdfOptions options = new com.aspose.imaging.imageoptions.PdfOptions(); | |
// Convert first frame of GIF to PDF | |
options.setMultiPageOptions(new com.aspose.imaging.imageoptions.MultiPageOptions(1)); | |
// Save PDF | |
image.save("gif-to-pdf.pdf", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load GIF image | |
com.aspose.imaging.Image image = com.aspose.imaging.Image.load("image.gif"); | |
// Set image options | |
com.aspose.imaging.imageoptions.PdfOptions options = new com.aspose.imaging.imageoptions.PdfOptions(); | |
// Create PdfDocumentInfo object and add information | |
PdfDocumentInfo docInfo = new PdfDocumentInfo(); | |
docInfo.setAuthor("Aspose"); | |
docInfo.setKeywords("GIF to PDF"); | |
docInfo.setSubject("GIF to PDF Convesion"); | |
docInfo.setTitle("Converting GIF Image to PDF File"); | |
// Set document info | |
options.setPdfDocumentInfo(docInfo); | |
// Save PDF | |
image.save("gif-to-pdf.pdf", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load GIF image | |
com.aspose.imaging.Image image = com.aspose.imaging.Image.load("image.gif"); | |
// Set image options | |
com.aspose.imaging.imageoptions.PdfOptions options = new com.aspose.imaging.imageoptions.PdfOptions(); | |
// Set size of the page | |
options.setPageSize(new SizeF(50, 100)); | |
// Save PDF | |
image.save("gif-to-pdf.pdf", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load GIF image | |
com.aspose.imaging.Image image = com.aspose.imaging.Image.load("image.gif"); | |
// Set image options | |
com.aspose.imaging.imageoptions.PdfOptions options = new com.aspose.imaging.imageoptions.PdfOptions(); | |
// Save PDF file | |
image.save("gif-to-pdf.pdf", options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment