
click on multiple links and save as pdf
조회 수: 1 (최근 30일)
이전 댓글 표시
I have 40 links imported in an excel sheet. Each link,when clicked, will lead to (Print as file) window for the page.
Is there anyway to open the multiple link, save the page as PDF with specific format (Year_Month_date) with one click ?
Regards
댓글 수: 0
답변 (1개)
Purvaja
2025년 9월 5일
Hi @Jabbar Khan
I have come together with a concise solution using MATLAB and headless Chrome, which you can run from MATLAB to automate the entire workflow. I have made a dummy excel sheet ("dummy_links.xlsx") with links of random websites. After running the below MATLAB script, we will have a folder called "PDFs" which will save all these links sequentially with name in the date format ("yyyy-mm-dd"). Each PDF is saved with sequential date as (e.g., 2025_09_01, 2025_09_02, …) so the filenames follow a daily sequence.
% Read links from Excel
T = readtable('dummy_links.xlsx');
urls = T.Links;
startDate = datetime(2025,9,1);
outDir = fullfile(pwd, 'PDFs');
if ~exist(outDir, 'dir')
mkdir(outDir);
end
% Path to Chrome
chromePath = '"..\chrome.exe"';
% Loop through each link
for i = 1:numel(urls)
url = urls{i};
fileDate = startDate + caldays(i-1);
dateStr = datestr(fileDate, 'yyyy_mm_dd');
fileName = sprintf('%s.pdf', dateStr);
outFile = fullfile(outDir, fileName)
cmd = sprintf('%s --headless --disable-gpu --print-to-pdf="%s" "%s"', ...
chromePath, outFile, url);
status = system(cmd);
if status == 0
fprintf('Saved PDF: %s\n', outFile);
else
warning('Failed for URL: %s\n', url);
end
end
This will create a folder named "PDFs" in the same folder and should look like:

Hope this helps you!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!