【ASP】HTML轉成PDF檔

首先,到官方網站下載並安裝之。

◇ 在命令提示下(開始→執行→cmd)
語法(參考):
C:\wkhtmltopdf\wkhtmltopdf    http://www.jason.com.tw/index.html    C:\pdf\index.pdf
       執行檔路徑                                  欲轉的HTML                                         想轉出的PDF

◇套用程式下(ASP)
在ASP執行應用程式有很多種,本篇是以ASPEXEC.DLL元件為主,如何應用與下載,詳情My Blog:執行應用程式並帶參數
語法(參考):
Set Executor = Server.CreateObject("ASPExec.Execute")   
    Executor.Application = Server.MapPath("/wkhtmltopdf") & "/wkhtmltopdf.exe"  '指定要執行的應用程式路徑
    '執行應用程式所需的參數   
    Executor.Parameters = "--orientation Landscape D:\PPC\tmpfile\台中都會區鐵路高架捷運化計畫經費管制表.html D:\ppc\123.pdf"                     
    strResult = Executor.ExecuteDosApp        
Set Executor = Nothing

參考資源:
官方網站

wkhtmltopdf  將 HTML 轉成 PDF 檔 (支援中文) 

留言

這個網誌中的熱門文章

【ASP】日期轉換(西元<-->民國)

【VB】使用NPOI元件來匯出Excel--DataTableToExcel

【SQL】符號切割字串變成多欄