Solved

Shell function and wkhtmltopdf in vb

Posted on 2011-03-12
2
1,275 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 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

20 Experts available now in Live!

Get 1:1 Help Now