使用在RHEL中运行的IBM WAS 9将PDF保存到TIFF文件时出现字符错误

时间:2018-05-27 02:40:10

标签: websphere pdfbox rhel icafe

从PDF保存到TIFF文件时,为什么复选框无法正常呈现。在我的本地计算机(Windows操作系统)中它运行正常但在运行于RHEL的IBM WAS 9中它不起作用。我正在使用TIFFTweaker(iCafe)将图像组合到TIFF文件和PDFRenderer(PdfBox 2.0.8)来渲染PDF图像。以下是示例代码:

渲染图片:

public BufferedImage renderImage(
        PDDocument document, int index, int dpi, ImageType imageType) 
                throws Exception {
    PDFRenderer renderer = new PDFRenderer(document);

    return renderer.renderImageWithDPI(index, dpi, imageType);
}

保存TIFF文件:

private void saveImage(String absoluteFilename, BufferedImage[] images) 
        throws IOException, Exception {
    if(images == null || images.length <= 0) {          
        return;
    }

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    RandomAccessOutputStream rout = new FileCacheRandomAccessOutputStream(baos);        

    ImageParam[] imageParams = new ImageParam[images.length];

    for (int i = 0; i < images.length; i++) {
        imageParams[i] = imageTool.getTiffBuilder(DPI).build();
    }

    TIFFTweaker.writeMultipageTIFF(rout, imageParams, images);

    byte[] byteArray = baos.toByteArray();

    if (byteArray != null && byteArray.length > 0) {
        fileToolManager.getFileTool().save(byteArray, absoluteFilename);
    }

    baos.close();
}

0 个答案:

没有答案