Skip to content

Instantly share code, notes, and snippets.

@wsdookadr
Last active January 7, 2024 18:00
Show Gist options
  • Save wsdookadr/812cb8224b59229c14fb0d3d0f6b2372 to your computer and use it in GitHub Desktop.
Save wsdookadr/812cb8224b59229c14fb0d3d0f6b2372 to your computer and use it in GitHub Desktop.
split PDF to images for upload to Miro
#!/bin/bash
# same without cropping or merging
PDF="$1"
rm -rf A B C
mkdir A B C 2>/dev/null
pdftk $PDF burst output A/%04d.pdf
find A/*.pdf | xargs -P5 -I{} bash -c '
a={};
b=$(echo $a | sed -e "s/pdf/png/g" | sed -e "s/^A/B/g");
c=$(echo $b | sed -e "s/^B/C/")
convert -density 200 -flatten -trim -quality 95 $a $b;
'
#!/bin/bash
PDF="$1"
rm -rf A B C
mkdir A B C 2>/dev/null
pdftk $PDF burst output A/%04d.pdf
find A/*.pdf | xargs -P5 -I{} bash -c '
a={};
b=$(echo $a | sed -e "s/pdf/png/g" | sed -e "s/^A/B/g");
c=$(echo $b | sed -e "s/^B/C/")
convert -density 200 -flatten -trim -quality 95 $a $b;
convert $b -crop 1042x1723+288+195 $c
'
# assemble into a big image with vertical stacked pages (top to bottom)
convert -density 200 -append `find C/ -name "*.png" | sort` big.png
  1. In Miro click the + sign
  2. Click Upload
  3. Click My Device
  4. Select the book pages from the B/ directory, all png images
  5. Wait for them to load
  6. Ctrl+A to select them all
  7. Align Left
  8. Click the square-like four-dot in the upper-right to get the 1-column layout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment