forked from aspose-imaging/Aspose.Imaging-for-Java
-
Notifications
You must be signed in to change notification settings - Fork 1
/
BMPToPDF.java
34 lines (29 loc) · 1011 Bytes
/
BMPToPDF.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.aspose.imaging.examples.ConvertingImages;
import com.aspose.imaging.Image;
import com.aspose.imaging.examples.Utils;
import com.aspose.imaging.fileformats.bmp.BmpImage;
import com.aspose.imaging.fileformats.jpeg.JpegImage;
import com.aspose.imaging.fileformats.pdf.PdfDocumentInfo;
import com.aspose.imaging.fileformats.psd.PsdImage;
import com.aspose.imaging.fileformats.svg.SvgImage;
import com.aspose.imaging.imageoptions.PdfOptions;
public class BMPToPDF {
public static void main(String... args) throws Exception
{
//ExStart:BMPToPDF
String dataDir = Utils.getSharedDataDir(BMPToPDF.class) + "ConvertingImages/";
String outputFile = "result.pdf";
BmpImage image = (BmpImage)Image.load(dataDir);
try
{
PdfOptions exportOptions = new PdfOptions();
exportOptions.setPdfDocumentInfo(new PdfDocumentInfo());
image.save(outputFile, exportOptions);
}
finally
{
image.close();
}
//ExEnd:BMPToPDF
}
}