I'm trying to convert a bunch of HTML files into PDF files. I'm looking for an automated solution so that i don't have to open each HTML file individually and convert it to PDF. In Mac OSX,
convert utility can be used to convert HTML files to PDF. I'm facing two problems.
convertutility is not applying CSS style to generated PDF content.
- My AppleScript for batch convert is not working.
Here's my AppleScript:
on open input_documents repeat with this_document in input_documents if this_document is not document file then set this_document_path to POSIX path of this_document do shell script "/System/Library/Printers/Libraries/convert -f " & quoted form of this_document_path & " -o " & quoted form of this_document_path & ".pdf" end if end repeat end open
I use this script to create a .app and then drag the documents folder onto the generated .app file. Note that all images associated with images are placed in a subdirectory/subfolder. My document structure looks like this:
/HTML /HTML/Images/ /HTML/a.html /HTML/b.html