PDF Scan to PNG
12 次查看(过去 30 天)
显示 更早的评论
Following the solution provided by a similar question, I was able to extract .png images from individual pdf pages. However, I am getting the following error when I run the code on some pdf files. I unfortunately cannot attach the trouble files as they have sensitive information, How can I correct this?
[ERROR] PDFStreamEngine - Cannot read JBIG2 image: jbig2-imageio is not installed
Thanks!
function images = PDFtoImg(pdfFile)
import org.apache.pdfbox.*
import java.io.*
filename = fullfile(pwd,pdfFile);
jFile = File(filename);
document = pdmodel.PDDocument.load(jFile);
pdfRenderer = rendering.PDFRenderer(document);
count = document.getNumberOfPages();
images = [];
for ii = 1:count
bim = pdfRenderer.renderImageWithDPI(ii-1, 300, rendering.ImageType.RGB);
images = [images (filename + "-" +"Page" + ii + ".png")];
tools.imageio.ImageIOUtil.writeImage(bim, filename + "-" +"Page" + ii + ".png", 300);
end
document.close()
3 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!