Skip to content

Instantly share code, notes, and snippets.

@exussum12
Created July 3, 2018 20:46
Show Gist options
  • Select an option

  • Save exussum12/b966eb92d06889a0fe211791d8422a2c to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown
Author

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

@exussum12

Copy link
Copy Markdown
Author

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

@shayanb

shayanb commented Apr 23, 2020

Copy link
Copy Markdown

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
Copy Markdown
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

shayanb commented Apr 23, 2020

Copy link
Copy Markdown

@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

shayanb commented May 4, 2020

Copy link
Copy Markdown

Any chance to got around this?

@devorel

devorel commented Feb 3, 2022

Copy link
Copy Markdown

it's font error . try install it .

@K-RAD

K-RAD commented Jun 6, 2025

Copy link
Copy Markdown

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