Question
· Apr 20, 2020

How to create pdf file from html

<html>
    <head>
        <title>LabCorp</title>
        <link rel="apple-touch-icon" sizes="60x60" href="app-assets/img/ico/apple-icon-60.png">
        <link rel="apple-touch-icon" sizes="76x76" href="app-assets/img/ico/apple-icon-76.png">
        <link rel="apple-touch-icon" sizes="120x120" href="app-assets/img/ico/apple-icon-120.png">
        <link rel="apple-touch-icon" sizes="152x152" href="app-assets/img/ico/apple-icon-152.png">
        <link rel="shortcut icon" type="image/x-icon" href="app-assets/img/ico/favicon.ico">
        <link rel="shortcut icon" type="image/png" href="app-assets/img/ico/favicon-32.png">
        <style>
            body, p, strong{font-size: 12px; font-family: Arial;}
            table tr td{font-size: 12px; font-family: Arial; padding: 2px 6px;}
            .borL{border-left:1px solid #333;}
            .borR{border-right:1px solid #333;}
            .borT{border-top:1px solid #333;}
            .borB{border-bottom:1px solid #333;}
            .border{border:1px solid #333;}
            
            @font-face {
                font-family: 'IDAutomationHC39M';
                src: url('d:/file/fonts/IDAutomationHC39M_0.ttf');
            }
            
            .IDAutomationCover {
                background: #f5f7fa;
                /*margin-top: 14px;
                padding-top: 45px;
                padding-left: 10px;*/
                padding-right: 10px;
            }
            .IDAutomationHC39M {
                font-family: IDAutomationHC39M;
                color: #525252;
                font-size: 20px;
                height: 80px;
                line-height: 80px;
                white-space: nowrap;
                margin-bottom: 0;
                padding-left: 10px;
                padding-right: 10px;
            }

            svg {
                border: 1px solid #000;
                padding-bottom: 4px;
            }
        </style>
    </head>
    <body>
    
    </body>
</html>

Discussion (8)2
Log in or sign up to continue

Hi Vivek,

We bought a license for CoolUtils (coolutils.com), whch also has  command line  functionality.  There are dozens of different converters with CoolUtils, but you can buy just the one.

We use a batch file for the command line, which will take two parameters, and an "option file" (used by the converter):

"C:\Program Files (x86)\TotalHTMLConverter\HTMLConverter.exe" "%1" "%2" -c pdf -fp -combine -si -pc Normal -ps letter -OptionFile %3

then call the batch file using $zf:

set command=dir_"Converters\html\ConvertHtmlToPDF.BAT"
set params(1)=fromHTMLfilename

set params(2)=toPDFfilename

set params(3)=OptionFileName

; NEXT: $ZF(-1) NOT USED BECAUSE ANY PROBLEM WITH THE CONVERTER PROGRAM WOULD CAUSE THIS PROCESS TO HANG UNTIL ETERNITY!!!
; Fire off HTML>PDF Converter program in background (-2 = don't wait)
status=$ZF(-100,"/ASYNC",command,.params)

 

The OptionFile has PDF codes like:

po=Landscape
PgHead=&b&d &t
PgFoot=&bPage &p of &P&bInsights powered by RevenueHealth Systems (C) 2018

I used the utility's "Command Line Parameters" help file to figure out how to set all the options, and how to use the option file.  I wrote a note to myself to "See http://www.verydoc.com/htmlprint-footer-header.html" for use on the pdf codes that are in the option file. 

It took a while, and I had to program in a new "language" of PDF options and stuff.

Good luck!