Package com.idrsolutions.image.pdf
Class PdfEncoder
java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.pdf.PdfEncoder
- All Implemented Interfaces:
com.idrsolutions.image.Encoder
public class PdfEncoder
extends com.idrsolutions.image.JDeliImage
implements com.idrsolutions.image.Encoder
Class generates a PDF from a BufferedImage or Image file
If the image is a multi-page TIFF then this class generates a multi-page PDF file
If the image is a multi-page TIFF then this class generates a multi-page PDF file
Example 1 (writing from a BufferedImage):
File pdfFile = new File("C:\\path\\to\\output\\file.pdf");
pdfFile.createNewFile();
PdfEncoder encoder = new PdfEncoder();
encoder.write(bufferedImage, pdfFile);
Example 2 (writing from a File):
File pdfFile = new File("C:\\path\\to\\output\\file.pdf");
pdfFile.createNewFile();
PdfEncoder encoder = new PdfEncoder();
encoder.write(new File("C:\\path\\to\\input\\image.PNG"), pdfFile); //can be BMP, JPEG, TIFF or any supported Image
-
Field Summary
Fields inherited from class com.idrsolutions.image.JDeliImage
bb
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
handle4ByteABGRRef
(BufferedImage image, byte[] alphas, StringBuilder sb, int sMaskRef) static byte[]
handleByteBinary
(BufferedImage image, StringBuilder sb) static byte[]
handleByteGray
(BufferedImage image, StringBuilder sb) static byte[]
handleDefault
(BufferedImage image, StringBuilder sb) static byte[]
handleIntARGBRef
(BufferedImage image, byte[] alphas, StringBuilder sb, int sMaskRef) void
write
(BufferedImage image, File pdfFile) Write a buffered image into a PDF file.void
write
(BufferedImage image, OutputStream bos) void
Writes an image file into a PDF file.Methods inherited from class com.idrsolutions.image.JDeliImage
optimiseImage
-
Constructor Details
-
PdfEncoder
-
PdfEncoder
public PdfEncoder()
-
-
Method Details
-
getEncoderOptions
- Specified by:
getEncoderOptions
in interfacecom.idrsolutions.image.Encoder
-
write
Write a buffered image into a PDF file.- Parameters:
image
- buffered image to be convertedpdfFile
- output PDF file to write to- Throws:
IOException
- if an error occurs in writing image
-
write
Writes an image file into a PDF file.If the file is a multi-page TIFF then this method writes a PDF with the same number of pages as the TIFF file contains.
- Parameters:
imageFile
- input image file to be convertedpdfFile
- output PDF file to write to- Throws:
IOException
- if an error occurs in writing imageException
-
handleDefault
-
handle4ByteABGRRef
public static byte[] handle4ByteABGRRef(BufferedImage image, byte[] alphas, StringBuilder sb, int sMaskRef) -
handleIntARGBRef
public static byte[] handleIntARGBRef(BufferedImage image, byte[] alphas, StringBuilder sb, int sMaskRef) -
handleByteBinary
-
handleByteGray
-
write
- Specified by:
write
in interfacecom.idrsolutions.image.Encoder
- Throws:
IOException
-