Solved

Shell function and wkhtmltopdf in vb

Posted on 2011-03-12
2
1,291 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:Pakhu1
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 35116736
Try putting quotes around all the files/paths:

    Com1 = Chr(34) & path & Chr(34) & " " & Chr(34) & File & Chr(34) & " " & Chr(34) & File1 & Chr(34) & " --disable-smart-shrinking"
0
 

Author Comment

by:Pakhu1
ID: 35119318
Thanks:

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

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now