I want to print pdf-pages but I get a parse exception, but cannot determine why..?
FileInputStream fis = new FileInputStream(fileToPrint.getAbsolutePath());
FileChannel fc = fis.getChannel();
ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
PDFFile pdfFile = new PDFFile(bb);
fc.close();
fis.close();
Exception: “Expected xref table or xref stream, but found Keyword: ef”
Thx.
It would appear that you’re getting a parse exception because your PDF library (which I assume is PDF-renderer, but you didn’t tell us in your question) thinks that the PDF file you are parsing is invalid.
The PDF library might be wrong, or your might actually have an invalid PDF file. Since you haven’t told us where this PDF came from, nor which PDF library you’re using, not whether other tools can open the PDF successfully, there’s not much more of an answer that we can give.