Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Empty PDF produced with Aspose.Pdf 9.0

$
0
0
HI,

I'm using the following code and image to create a PDF from a TIFF file. 
In the result I get an empty (0kb) file. Please help.


File file = new File("path.tiff");
File pdfFile = File.createTempFile("renderer_", ".pdf");
//Instantiate Pdf instance by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a new section in the Pdf object
Section sec1 = pdf1.getSections().add();
//Create an image object in the section
Image image = new aspose.pdf.Image(sec1);
//Add image object into the Paragraphs collection of the section
sec1.getParagraphs().add(image);
//Set the ImageStream information
image.getImageInfo().setSystemImage(ImageIO.read(file));
// set the value that all frames of tiff image need be added into PDF document
image.getImageInfo().setTiffFrame(-1);
//Save the pdf document
pdf1.save(pdfFile.getAbsolutePath());


It works fine for other image formats with the code provided on the sample page below:
http://www.aspose.com/docs/display/pdfjava/How+to+Convert+an+Image+to+PDF
Thanks,
Mariusz

Viewing all articles
Browse latest Browse all 3131

Trending Articles