Install wkhtmltopdf on heroku using java application

I managed to download my spring boot website online on Heroku. But I also use wkhtmltopdf to create pdf. This works locally, but now I have some problems.

Offline works as follows:

        ProcessBuilder pb = new ProcessBuilder
                ("cmd.exe",
                        "/c",
                        " cd C:\\Program Files\\wkhtmltopdf\\bin && wkhtmltopdf.exe "
                + "http://google.com C:\\MainWebApps\\TestApp\\src\\main\\resources\\userstorage\\Google2.pdf");

But how to install it on Heroku?

Where to store a temporary html page so that I can create a PDF file?

Where is wkhtmltopdf installed on Heroku?

Is it possible to call wkhtmltopdf using processbuilder on heroku?

EDIT

So, after ceejayoz comment, I searched a little Google and found some interesting stuff.

So, to compile the binaries on Heroku, I used this:

heroku run /bin/bash

Then I made curl wkhtmltopdf as follows:

curl -O http://download.gna.org/wkhtmltopdf/0.12/0.12.0/wkhtmltox-linux-amd64_0.12.0-03c001d.tar.xz 

Then I tried to extract it on the server, but to no avail:

 $ tar -xjvf wkhtmltox-linux-amd64_0.12.0-03c001d.tar.xz
tar (child): wkhtmltox-linux-amd64_0.12.0-03c001d.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2

tar: Error is not recoverable: exiting now

EDIT2

https://github.com/dscout/wkhtmltopdf-buildpack github.

, :

 heroku buildpacks:set 'https://github.com/heroku/heroku-buildpack-multi.git'
 echo 'https://github.com/dscout/wkhtmltopdf-buildpack.git' >> .buildpacks

.buildpacks, ?

, Wkhtmltopdf Nodejs Heroku

- , ?

+4
2

, -

  • /
  • .pdf

, Heroku ( Heroku git), # 1, @ceejayoz - git. , . /bin. ( Procfile) , ProcessBuilder .

Caveat - , Windows, , , , , (, / ).

- , . , , ...

, PDF- . dyno (. https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem). , , , - (Amazon S3 - ).

, .

0

, wkhtmltopdf-binary. wkhtmltopdf VCS. , , Maven Gradle.

0

Source: https://habr.com/ru/post/1617252/


All Articles