Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Shell function and wkhtmltopdf in vb

Posted on 2011-03-12
2
Medium Priority
?
1,341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Screencast - Getting to Know the Pipeline

610 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