pdf2svg
pdf2svg copied to clipboard
Any advice on how to build a standalone binary for linux?
The boxes I need this to run on I can not download or install anything on but I can include in my git repo a binary as I already to with pdftk.
But this tool would be a lot better option since it does both steps for me in one eg make pages and images.
Thanks for you work!
it is an ubuntu box I need to make this for btw. I tried this http://jurjenbokma.com/ApprenticesNotes/getting_statlinked_binaries_on_debian.html but it did not work.
If using your (pressumably remote) git repo is an option, then I suggest you install junest. When you are done installing and adding junest
to your $PATH
, do the following:
junest -f
pacman -Syy
pacman -S pdf2svg
Exit junest
(Ctrl-D) and setup an alias in your .bashrc
:
alias pdf2svg='junest -- pdf2svg'
Close the Terminal and open a new one.
Enjoy!
Here's a more portable procedure:
- On a Linux (possibly virtual) machine where
pdf2svg
is installed download the CARE binary. - Make it executable
chmod +x care-x86_64
- Wrap
pdf2svg
in a self-contained environment:./care-x86_64 pdf2svg
- On the machine where you want to use
pdf2svg
extract the archive:./care-XXXX.bin
- Tell CARE about the directory where your PDFs are stored:
-
nano care-XXXX/re-execute.sh
- Scroll down until you find lines starting with
-b
- Add the following line to the family:
-b "/home/USER/path/to/your/pdfs" \
- Find the line nearby that begins with
-w
and update your$HOME
accordingly. - Save (
Ctrl + O
) and exit (Ctrl + X
)
-
- Run
./care-XXXX/re-execute.sh pdf2svg /home/USER/path/to/your/pdfs/file.pdf /home/USER/path/to/your/pdfs/file.svg
Enjoy!
Quite an old issue, but with the great help of the poppler folks, I finally I managed to build a true completely static pdf2svg binary. Perhaps this is also useful for others, so I'm posting it here. I used an Ubuntu Cosmic docker container to build it. Here is the relevant excerpt of the docker file:
https://gist.github.com/rgpublic/1a721599332402f55625afc3886b967a
Even if you don't want to use Docker and/or a Docker file, the necessary steps are pretty easy to understand as you can see.
NB: Working inside a docker container is only recommended in order to not spoil your system with all the unnecessary installs and packages. After you've build the static binary, you can take it anywhere and run it. Docker is NOT required later to use the static binary, of course.
The resulting binary is about 17 MB.
Today (2020-09-23) I managed to compile this on CentOS 8. I needed to make some adaptions as follows:
Comment out line 90 in the source code by inserting "//" at the beginning of the line.: { pdf2svg.c:90:2: warning: ‘g_type_init’ is deprecated [-Wdeprecated-declarations] }
In order to have the development libraries available for compiling: dnf install poppler-devel dnf install poppler-glib-devel
Changed configure's line 2072 to "if true ; then " to bypass the deprecated test. { if eval "$MISSING --is-lightweight"; then -- is outdated}
I also could not find the code in pdf2svg-0.2.3-12.fc33.src.rpm
Today (2020-09-23) I managed to compile this on CentOS 8. I needed to make some adaptions as follows:
@DanieW: would you be able to submit a PR with these changes in? I'm sure others would appreciate them,
Sorry, I was mistaken. It seems I have to do: cat pdf2svg-0.2.3-12.fc33.src.rpm | rpm2cpio - | cpio -tv to extract the source, whereas I tried rpm -ivh --prefix=/opt pdf2svg-0.2.3-12.fc33.src.rpm But still I propose the changes above.