File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.io.IOException: Write error at PdfFileSpecification

 
ramesh poorella
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

i am getting java.io.IOException: Write error at PdfFileSpecification. please help me on this,


RandomAccessFileOrArray myTifFile = new RandomAccessFileOrArray(file);

int numberOfPages = TiffImage.getNumberOfPages("D://myTifFile.tif");
FileOutputStream os=new FileOutputStream("D://mypdffile.pdf");
com.itextpdf.text.Document TifftoPDF=new com.itextpdf.text.Document();

PDFWriter writer = PDFwriter.getInstance(TifftoPDF, os);


writer.setStrictImageSequence(true);

TifftoPDF.open();

for(int tiffImageCounter = 1;tiffImageCounter <= numberOfPages;tiffImageCounter++) {
com.itextpdf.text.Image img = TiffImage.getTiffImage(myTifFile, tiffImageCounter);

Rectangle pageSize = new Rectangle(img.getWidth(),
img.getHeight());
TifftoPDF.setPageSize(pageSize);
TifftoPDF.newPage();
TifftoPDF.add(img);


}

TifftoPDF.close();
TifftoPDF.toString();
PdfFileSpecification.fileEmbedded(writer, "D://mypdffile.pdf", null, null, true, "applications/pdf", null);




Thanks,
Ramesh
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic