Open bertsky opened 3 years ago
prima-page-to-pdf uses itext5 but even the newer itext7 does not support > 8 bit per channel AFAICT https://github.com/itext/itext7/blob/9fadebfb114a7ee9ef9058a8b0c9deec71262210/io/src/main/java/com/itextpdf/io/image/TiffImageHelper.java#L349-L357
This can only be dealt with in itextpdf. Each addPage has a try/catch. I guess we could add a cmd argument to stop on exception /**
This can only be dealt with in itextpdf. Each addPage has a try/catch. I guess we could add a cmd argument to stop on exception
/** * Adds the document page image to the current PDF page (spanning the whole page). */ private void addImage(String filepath, PdfWriter writer, Document doc, Page page) throws MalformedURLException, IOException, DocumentException { PdfContentByte cb = writer.getDirectContentUnder(); cb.saveState(); Image img = Image.getInstance(filepath); img.setAbsolutePosition(0f, 0f); img.scaleToFit(page.getLayout().getWidth(), page.getLayout().getHeight()); cb.addImage(img); cb.restoreState(); }
I don't understand that TBH, but IMHO the program should stop with non-zero exit status by default if anything goes wrong (on any page). Perhaps some --keep-going
option (for trying all pages regardless) can be useful under certain circumstances, but the normal expectation is that this just converts everything (not just something or nothing despite the success retval).
I have a TrueColor RGB TIFF (i.e. 3x16 bit depth), for which the latest PageToPdf.jar prebuilt release gives me:
This is true for both OpenJDK 8 and 11. Would it be possible to integrate a TIFF library with more capabilities?
And more importantly: could you please ensure the tool at least returns with a non-zero exit status, so I won't need to parse the stdout for exception texts?