how to overcome this?i am able to read some of my pdf using below code, but still some are unreadable?

1 view (last 30 days)
clear java
javaaddpath('C:\Users\Hp-Pc\Documents\MATLAB\PDFBox-0.7.3\lib\PDFBox-0.7.3.jar')
pdfdoc = org.pdfbox.pdmodel.PDDocument;
reader = org.pdfbox.util.PDFTextStripper;
pdfdoc = pdfdoc.load('C:\Users\Hp-Pc\Documents\MATLAB\chemical.pdf');
pdfdoc.isEncrypted
%%text, with planty of padding
pdfstr = reader.getText(pdfdoc) %#ok
class(pdfstr)
pdfstr = char(pdfstr) %#ok
class(pdfstr)
%%text 'unpadded'
pdfstr = deblank(pdfstr) %#ok
%%will get an error here..
pdfdoc = pdfdoc.load('C:\Users\Hp-Pc\Documents\MATLAB\chemical.pdf');
pdfdoc.isEncrypted
pdfstr = reader.getText(pdfdoc) %#ok
%%but press forward..
pdfdoc.getDocument().close;

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!