As described and solved by @Mofi in the previous question for individual files, I would like to use wkhtmltopdf to generate a single PDF file with the contents from a list of URLs within a text file.
The code below that Mofi provided works perfectly well for using the list of URLs to generate individual PDFs
@echo off
cd /D "%ProgramFiles%\wkhtmltopdf\bin" || exit /B if
for /F useback^ delims^=^ eol^= %%I in ("%ProgramFiles%\wkhtmltopdf\bin\urls.txt") do wkhtmltopdf.exe "%%~I" "%ProgramFiles%\wkhtmltopdf\bin\pdfs\%%~nI.pdf"
pause
I thought that by using the following code (by removing the loop from the pdf filename part) it would work. But it turned out that the PDF file kept rewriting itself with the article of the last URL it processed from the txt file.
@echo off
cd /D "%ProgramFiles%\wkhtmltopdf\bin" || exit /B if
for /F useback^ delims^=^ eol^= %%I in ("%ProgramFiles%\wkhtmltopdf\bin\urls.txt") do wkhtmltopdf.exe "%%~I" "%ProgramFiles%\wkhtmltopdf\bin\pdfs\master.pdf"
pause
What I need it do now, is just how to tweak this piece of code so as the batch file reads the URLs from the urls.txt file, there is a single PDF file generated which keeps growing in size by adding the contents of each URL into this single PDF.