Skip to content

Instantly share code, notes, and snippets.

@exussum12
Created July 3, 2018 20:46
Show Gist options
  • Save exussum12/b966eb92d06889a0fe211791d8422a2c to your computer and use it in GitHub Desktop.
Save exussum12/b966eb92d06889a0fe211791d8422a2c to your computer and use it in GitHub Desktop.
FlippingBook to PDF
#!/bin/bash
mkdir -p out
for i in $(seq 1 120); do
page=`printf "%04d" $i`;
wget "https://www.website/files/assets/common/page-html5-substrates/page${page}_4.jpg"
wget "https://www.website/files/assets/common/page-vectorlayers/${page}.svg"
convert -flatten -geometry 1149x2550 -fuzz 10% -transparent white -density 400 page${page}_4.jpg $page.svg out/$page.pdf
done;
cd out
pdfunite * out.pdf
@exussum12
Copy link
Author

there is a bug with the svg embedded font. not sure how to fix that

@exussum12
Copy link
Author

Its a bug with most svg renderers. wkhtmltoimage can render correctly need to convert to that

@shayanb
Copy link

shayanb commented Apr 23, 2020

I get this error when trying to run convert command, any ideas why?

convert: non-conforming drawing primitive definition `stroke-linecap' @ error/draw.c/RenderMVGContent/4434.

@exussum12
Copy link
Author

Could you upload the jpg or SVG it's having trouble with. I completely forgot I made this.

That error is usually to do with one of the inputs not being in the correct format. It's possible that since I wrote the script the magazine format has changed

@shayanb
Copy link

shayanb commented Apr 23, 2020

@exussum12 I'm discussing this issue here and there is a sample file as well: ImageMagick/ImageMagick#974 (comment)

Thanks for checking on this

@shayanb
Copy link

shayanb commented May 4, 2020

Any chance to got around this?

@devorel
Copy link

devorel commented Feb 3, 2022

it's font error . try install it .

@K-RAD
Copy link

K-RAD commented Jun 6, 2025

I got this to work, but the resulting pdf pages are missing some letters here and there. Any idea why that happens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment