How to extract data from PDF that contains a plot and a table
103 views (last 30 days)
Show older comments
Hi,
I have thousands of PDFs that has similar format to the one attached. It starts with a plot, then it has a summary table with values.
I need to be able to extract the numbers in the table and store them in a matrix to be processed later (can exclude first column due to the word "average"). I will also need to be able to loop/read through the pdfs and extract the numbers. the PDF's name are in a number sequential order.
I have tried several things and it didn't work. I will appreciate any help. Thanks in advance.
2 Comments
sherry james
on 28 Dec 2018
Hi,
As you said you want to extract the numbers present in the table then you should use some application that can easily extract data from PDF. Once such utility is SysTools PDF Toolbox Software. With this software you can extract numbers from multiple PDF documents and the data for each individual PDF is saved in the seperate .txt document.
Visit the link & extract numbers: https://www.systoolsgroup.com/pdf-toolbox.html
Answers (3)
Surbhi Pillai
on 31 Dec 2018
Hi Camila
You can refer to the below MATLAB Answers link to understand the extraction of data from a pdf file in MATLAB.
I hope this helps....
0 Comments
DGM
on 29 Nov 2023
fname = '35517.001.pdf';
str = extractFileText(fname);
% get the main table
T = extractBetween(str,'Dmax','AVERAGE');
T = strcat('Dmax',T);
T = split(T,newline);
% get rid of empty lines, reshape
mk = ~cellfun('isempty',T);
T = T(mk);
T = reshape(T,[],7);
% get the last row (the column averages)
lastrow = extractAfter(str,'AVERAGE');
lastrow = split(lastrow,newline);
% get rid of empty lines, reshape
mk = ~cellfun('isempty',lastrow);
lastrow = lastrow(mk);
lastrow = reshape(lastrow,[],7);
% convert to numeric data
data = str2double(T(2:end,:))
averages = str2double(lastrow)
% extract column headers if you want to make a table or something
headers = T(1,:)
Generally, it's not that simple. See also:
You can't generally rely on tabular data being presented in the expected order. In my experience, it's not even guaranteed that a set of similar-looking related files has a consistent ordering. I don't know how extractFileText() works, but I bet that you will have to check the integrity of all your extracted data if you want to be sure it's not mixed up nonsense.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!