[Html2PdfConverter] Administration

[Html2PdfConverter] Administration

  
Forge Component
(40)
Published on 24 Mar by Guilherme Pereira
40 votes
Published on 24 Mar by Guilherme Pereira
Trying to use the HTML to PDF Converter and after reading the instalation guide I'm mystified as to what files to upload. Going to the download page and downloading version 0.12.2.1 of wkhtmltopdf in any windows format basically only includes two exe's and a Dll (wkhtmltoimage.exe, wkhtmltopdf.exe, wkhtmltox.dll) None of which upload from the administration page. The help seems to reference a archive file with specific Dll's in it.

Can anyone tell me how to obtain the correct files?

Cheers
Hi Steve,

The wkhtml has two versions mingw and msvsc. if you're using OutSystems PaaS (Enterprise or Personal) I recommend you using the mingw.

If you're using an OnPremises installation you can use the msvsc but you'll have to instal msvsc2013 I guess on your servers.

Each have different dlls required and you should upload accordingly.

In this thread I helped  some community members with solving an issue and has more information about ir and how you can install.

Cheers,
Guilherme
Hi Guilherme,
Thanks for the reply I have tried after reading the full post mentioned but I'm still having an issue uploading some of the required files. I have managed to upload some of the additional files ok but the two exe's and the main dll fail to upload. In Chrome I see the upload progress go to 100% although it seems to try to upload the same file two or three times. It then comes up with an internal error message. In IE the screen seems to just time out after a few minutes. I have downloaded "wkhtmltox-0.12.2.1_mingw-w64-cross-win32.exe" which in cludes the files however I notice that they are 40mb each. 
Screen file listing:


Admin page:


I'm not sure what is stopping the files being uploaded to the server.

Any help would be appreciated.

Thanks

Steve
Hi Steve,

I've seen that pattern in the past and its related with network and the fact that the files are large and not from the component. I can tell you that in order to be able to upload into my Personal Environment on the cloud I had to connect an ethernet cable because with my office wi fi I wasn't able.

Just make sure that your network conditions (firewalls, proxies, etc) allow you to upload.
And i think that in your version wkhtmltox.dll is not needed (and you'll save an additional upload).

Cheers
Guilherme
Hi Guilherme,
I have managed to get the files to upload. I needed to increase the maxRequestLength inside the webconfig to allow the file to be uploaded.

Thanks for your assistance.

Regards

Steve
Hi, steve can you please post a step by step process on your fix? I'm a complete noob with the same problem.
Charles Nefdt wrote:
Hi, steve can you please post a step by step process on your fix? I'm a complete noob with the same problem.
 Hi Charles,
The steps I followed are as follows:
1. Download Wkhtmltopdf installer from http://wkhtmltopdf.org/downloads.html I used the windows MinGW version
2. Open the installer with 7zip or something similar and extract the following files:

3. Configure the environment to allow large files to be uploaded. This is achieved by downloading the espace from the forge named "Service Center Factory Configuration".
3.1 Open and launch the espace then create a new shared configuration.
3.2 Give the custom configuration a name like "Upload_Large_Files". There are some pre-made samples available so you can pre-populate the template as a starting point. I used the "Custom HttpRuntime Parameters (.NET). 
3.3 Set the "Kind" to web.config_XSL
3.4 in the value field you should have the following (or something similar)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/> 
 
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
        
    <xsl:template match="/configuration/system.web/httpRuntime">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
            <xsl:attribute name="executionTimeout">360</xsl:attribute>
            <xsl:attribute name="maxRequestLength">65536</xsl:attribute>
        </xsl:copy>
    </xsl:template>
 
</xsl:stylesheet>

Edit the values to allow a timeout and maxrequestlength that will allow the files to be uploaded. The default request length is only 4096kb so will need to be increased to 50000 or so.

3.4 Save the configuration
3.5 back on the Espaces tab of the factory configuration find the htmltopdfconverter espace and select it.
3.6 associate the newly created large file configuration with this eSpace.

4 You should now be able to launch the HTML2PDFConverter eSpace and upload the required files. 
4.1 Go to the administration page
4.2 upload wkhtmltopdf.exe to the pdf generator 
4.3 wait for it to upload
4.4 upload wkhtmltoimage to the image generator
4.5 wait....
4.6 upload the 4 dll's to the additional binaries area (one at a time)

5. You should now be able to produce pdf's and images using the pdf link and image link in the espace. If this is working you can simply add a reference to the espace in your own project and start prodicing PDF's etc.

I hope this helps you to get up and running. I am only a new to using OS but this worked for me. I seem to remember having an issue choosing between 32 and 64 bit version's of the download.

Regards

Steve

 

 
I am now facing an issue with the factory configuration espace not recognizing my login credentials

Any idea why this is happening?

Many thanks, your help it is much appreciated.

I'm sorry Charles I completely forgot a step.
With the Factory Configuration eSpace open navigate to the Logic page and under Web Services select the Operation Service and re-configure the URL to point to your environment e.g.

http://YourEnvironment/ServiceCenter/Operation.asmx?wsdl
Then you should be good to go.
 
Hi Steve,

Very detail description and very helpfull let me just add two remarks:

You can configure the endpoint of your webservices without having to change the code. You can do that by opening your management console (aka ServiceCenter) and going to Factory -> Espaces -> (Your Espace Module) - > WebServices and there you can change the url without having to change the code



The second remark is that I believe the wkhtmltox.dll is not needed in the MinGW version so if you can test and delete it you'll saving 50MB on your DB and other 50MB on your filesystem (and space is a valuable resource specially on the PersonalEnvironment).

Cheers,
Guilherme
Thanks Guillherme,
I'm just getting my head around the system myself and help like yours is really appreciated. The inital learning curve is always the trickiest part and any information that puts us on track saves us so much time.

Cheers

Steve
Hi Steve,

       I followed your steps in installing properly the HTMLtoPDFConverter. However I had difficulties in the following part:

 3.5 back on the Espaces tab of the factory configuration find the htmltopdfconverter espace and select it.
  3.6 associate the newly created large file configuration with this eSpace. I have the HTMLtoPDFConverter installed in our environment but the factory configuration below only displays the Users. Why does it do that?



Hi Lawrence,
I have not actually looked at this since March. I have tried to take a quick look but notice the service has changed in the current version of the platform. I cant help much really other than to say something has changed in a version between 9.0.0.1 and 9.0.1.15 that effects this.

If I get a chance Ill will investigate.

Cheers

Steve
Hi Steve, 

With your response it seems I am stuck with this. I hope others will have the answer my query. thank you for your reply.
 I was able to resolve this issue by going in to the LifeTime, granted access to HTMLtoPDFConverter Espace to a User, and it can now be associated with the shared config file.
Another problem, This is already my configuration file. But up until 29%, the upload reverts back to 0. any thoughts? This is really getting very frustrating.. why do I need to even configure all of this when I just want to generate a PDF from a URL..

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/> 
 
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
        
    <xsl:template match="/configuration/system.web/httpRuntime">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
            <xsl:attribute name="executionTimeout">360</xsl:attribute>
            <xsl:attribute name="maxRequestLength">65536</xsl:attribute>
        </xsl:copy>
    </xsl:template>
 
</xsl:stylesheet>
 Hi Steve, I really need your input on this. Thanks.
Lawrence basically got the files uploaded (and got the component to work) by increasing the executionTimeout and maxRequestLength as suggested by OutSystems Support.

Cheers!