print html logo       Home Download FAQ Guide Contact

How to print a PDF file from a command line

This is a guide on how to create a PDF file from HTML content. It is done with command line instructions in a batch file.

Step by step instructions

Install Bullzip PDF Printer

Download and install the PDF Printer from Bullzip.com at the link http://www.bullzip.com/products/pdf/info.php.

Install PrintHTML

Download and install PrintHTML form this site.

DHTML Editing Control

Download and install the DHTML Editing Control for Applications.

Create the Batch File

With these tools installed we can now create the actual batch file that will print a HTML string to a PDF file.

REM --
REM -- Create PDF file from a command line
REM --

REM -- We need the path of the two program we use in this example
SET PDFCONFIG=C:\Program Files\Bullzip\PDF Printer\API\EXE\config.exe
SET PRINTHTML=C:\Program Files\PrintHTML\printhtml.exe

REM -- Clear settings.ini
REM -- More info at http://www.biopdf.com/guide/configuration_files.php
"%PDFCONFIG%" /C

REM -- SET PDF SETTINGS
REM -- More info at http://www.biopdf.com/guide/settings.php

REM -- Set PDF file name. The %CD% variable is the current folder of the batch file.
"%PDFCONFIG%" /S "Output" "%CD%\example.pdf"

REM -- Hide settings dialog
"%PDFCONFIG%" /S "ShowSettings" "never"

REM -- Disable overwrite confirmation
"%PDFCONFIG%" /S "ConfirmOverwrite" "no"

REM -- Show PDF after conversion
"%PDFCONFIG%" /S "ShowPDF" "yes"

REM -- Print HTML
"%PRINTHTML%" html="Howto print a PDF file from a command line" header="Print from a batch file" footer="&d"

The batch file will modify the settings.ini file when using the PDF printer. This example could be refined quite a bit if you have good knowledge about the Bullzip PDF Printer. By using the COM API of the PDF Printer you could make better support for concurrency and control the runonce.ini instead of the settings.ini. More info on this can be found in the bioPDF Guide section for the commercial version of the Bullzip PDF Printer.