Link to home
Start Free TrialLog in
Avatar of Pakhu1
Pakhu1Flag for Afghanistan

asked on

Shell function and wkhtmltopdf in vb

I need to to convert html files into pdf. I found this program, wkhtmltopdf, that seems to meet my needs. It runs from a command line, which I call by means of the shell function. I succeed doing basic conversion, but as soon as I try to customize it using some options, the program does nothing. I must missuse either the shell function or wkhtmltopdf itself, but I don't know what I'm doing wrong. I tryed with other basic options but none seems to work.

In the code attached Com0  works fine (there is no option), but Com1 fails. The latter uses an option I'm interested in (disabling the smart shrinking propoerty)
Dim Com1 As String, Com0 As String
    Dim path As String
    Dim Id As Double
    Dim File As String, File1 As String


    path = "C:\Documents and Settings\Francesc\Mis documentos\E-Gestion\wkhtmltopdf\wkhtmltopdf.exe"
    File = "file:///C:/Documents and Settings/FFFF/A.html"
    File = Replace(File, "\", "/")
    File = Replace(File, " ", "%20")
    
    File1 = "C:\Documents and Settings\FFFF\A.pdf"
    Com0 = path & " " & File & " " & Chr(34) & File1 & Chr(34)
    Com1 = path & " " & File & " " & Chr(34) & File1 & Chr(34) & " --disable-smart-shrinking"

   
    Call Shell(Com)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pakhu1

ASKER

Thanks:

Again the same result: it works without option but not when adding that or any other option