"Not recognized as an internal or external command..." Error.

654 views
Skip to first unread message

Sean Lehning

unread,
May 30, 2022, 10:05:46 PM5/30/22
to wkhtmltopdf General
I'm looking for an option to batch convert html files to PDFs, and so far wkhtmltopdf seems like a good option. However, I can't get off the ground since the command line just isn't working. 

I try to type along with a tutorial I found, but I just keep getting "'Program' is not recognized as an internal or external command,
operable program or batch file."

The batch instructions I'm trying to eventually follow are at the bottom of this article: https://listoffreeware.com/software-batch-convert-html-to-pdf-windows/

James Young

unread,
Jun 1, 2022, 9:56:34 AM6/1/22
to wkhtmltopdf General
You will have to get the program installed and working before you move on to batch files. I watched the same video tutorial to install my copy both on my Windows laptop and Windows server with no problems. 
I use a scheduled task to trigger cURL converting an .asp page into a batch file then another scheduled task to run that batch file which then creates 900+ .pdfs at 3am overwriting the ones previously created the nigh before, that way my catalogue of pdfs is constantly up to date. 
If that sounds like what you want to do get back to me when you have your installation up and running.

Sean Lehning

unread,
Jun 1, 2022, 11:59:39 PM6/1/22
to wkhtmltopdf General
I made sure it was installed correctly and watched the tutorial more closely (as well as watching more general command line tutorials, so I know what all the seemingly random commands actually do). I finally got to the point where I could create functioning PDFs and even learned some additional tricks. For example, when I tried to do a PDF of one news article, the original PDF was just 1 page and displayed "Show more" at the bottom (basically it only captured the preview of the article). I then put -n in the command line which apparently disables some website features in the download/conversion. True enough the PDF came out messier in terms of being a replica of the webpage (i.e. news logos completely in the wrong places), but the full text of the article was readily intact. 

Now I'm ready to get more details on how to go from prototyping and proofs of concept to mass production; how exactly would I create a batch file and "run it" into the program?

Sean Lehning

unread,
Jun 2, 2022, 12:00:29 AM6/2/22
to wkhtmltopdf General
Thank you for the help, by the way. It's been such a huge sigh of relief to have someone helping me.

On Wednesday, June 1, 2022 at 8:56:34 AM UTC-5 jamesy...@gmail.com wrote:

James Young

unread,
Jun 6, 2022, 11:48:41 AM6/6/22
to wkhtmltopdf General
I use cURL (Google it) in my first batch file (proboat3.bat)  to to run a .asp recordset which then generates the second batch file (proboat4.bat) that then creates my PDFs, the first batch file is proboat3.bat and it creates proboat4.bat,  proboat3.bat looks like this;

curl https://www.proboat.co.uk/pdf_bat.asp > C:\Users\Elizabeth\Desktop\Proboat4.bat

https://www.proboat.co.uk/pdf_bat.asp outputs this and cURL saves it as proboat4.bat batch file.

proboat4.bat looks like this;

@echo off
  "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" https://www.proboat.co.uk/item-PDF/1/300/2268/Allen-Complete-Optimist-sprit-system "C:\Brakeysolutions\ProBoat\PDFs\2268-Allen-Complete-Optimist-sprit-system.pdf"
  Timeout /t 1 /nobreak
  echo Complete!
 
@echo off
  "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" https://www.proboat.co.uk/item-PDF/1/123/2267/Allen-Laser-ILCA-XD-Cam-Cleat-Plate "C:\Brakeysolutions\ProBoat\PDFs\2267-Allen-Laser-ILCA-XD-Cam-Cleat-Plate.pdf"
  Timeout /t 1 /nobreak
  echo Complete!
 
 
times 1,800 items in the catalogue.

I use Task Scheduler to activate these batch files a 3am, proboat3.bat at 3:09 and proboat4.bat at 3:10.

Also I have made a specific page  that I use for my PDFs "https://www.proboat.co.uk/item-PDF.asp?prod=" laid out in black and white, no prices, no links, just the information I want to get across in my PDF.

I hope that this helps if you get too stuck get back to me.

Regards
James 

Reply all
Reply to author
Forward
0 new messages