PDF Annotation not visible on Image using pdfbox API

旧时模样 提交于 2019-12-25 12:59:04

问题


I have text annotation on my pdf but when I am converting pdf to image file using pdfbox api, annotation disappears(not visible on image). I have searched for couple of forums but I did not get accurate answer of this question.

for (int page = 0; page < document.getNumberOfPages(); ++page) {
    BufferedImage bim = pdfRenderer.renderImageWithDPI(page,70,ImageType.RGB);

    // suffix in filename will be used as the file format
    ImageIOUtil.writeImage(bim, pdfFullPath + "-" + (page+1) + ".png", 70);
}

Creating Text annotation like below

//generate instanse for annotation
PDAnnotationTextMarkup txtMark = new PDAnnotationTextMarkup(PDAnnotationTextMarkup.SUB_TYPE_FREETEXT);

Some of the forums, I have read that one need to set Appearance to above object. But how I need to set appearance object to make annotation visible on my image.

Any help is greatly appriciated

来源:https://stackoverflow.com/questions/43387039/pdf-annotation-not-visible-on-image-using-pdfbox-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!