続・パイプを通るPDF

 続・パイプを通るPDF

ワンライナーでPDFに絵を描きましょう

2377be1c3f33751ea7c73a7bd8d58996?s=128

T. MOTOOKA

April 07, 2018
Tweet

Transcript

  1. ଓɾύΠϓΛ௨Δ1%' ୈճγΣϧܳษڧձ -5 CZ5.0500,"

  2. ୭ʁ w !U@NPUPPLB w େࡕαςϥΠτͷํ͔Βདྷ·ͨ͠ w झຯɿ47(ඳ͍ͨΓ1%'ॻ͍ͨΓ w ৬ۀ w

    1)1ॻ͍ͨΓ42-ॻ͍ͨΓ w ޿ٛͷ 1%'ॻ͍ͨΓ w )FBMUI$IFDLͷ௨Βͳ͍αʔόͷ؅ཧऀ w ݩϢʔϑΥχΞϜ૗ऀ
  3. None
  4. લճ·Ͱͷ͋Β͢͡ w ୈճγΣϧܳษڧձେࡕαςϥΠτ-5 w *NBHF.BHJDLDPOWFSUͰɺۭͬΆͷ1%'Λ࡞ΕΔ w ͦΕ͸45%065ʹు͚Δʂʂ w IFBEʹ౉ͤ͹ϔομ͕ݟ͑Δʢ͓͓͓͓͓ʂʂʂʂʂʣ w

    Ԡ༻ͷ༨஍ɺ͍Ζ͍Ζ͋ΔΑͶʙʙɹ׬
  5. 1%'ΑɺύΠϓΛ௨Εʂ

  6. ۭͬΆͷ1%'Λు͘ convert xc:none -page A4 pdf:-

  7. (IPTU4DSJQUͰ/001 convert xc:none -page A4 pdf:- \ | gs -q

    -sOutputFile=- -sDEVICE=pdfwrite -
  8. ઢΛҾ͘ convert xc:none -page A4 pdf:-\ | gs -q -sOutputFile=-

    -sDEVICE=pdfwrite \ -c '<< /EndPage { exch pop 2 lt { newpath 200 300 moveto 10 200 rlineto closepath 0.8 0.2 0.1 setrgbcolor stroke true }{false} ifelse } bind >> setpagedevice'\ -
  9. ѹॖ͞ΕͨඳըࢦࣔΛ৳௕ convert xc:none -page A4 pdf:-\ | gs -q -sOutputFile=-

    -sDEVICE=pdfwrite \ -c '<< /EndPage { exch pop 2 lt { newpath 200 300 moveto 10 200 rlineto closepath 100 0 0 setrgbcolor stroke true }{false} ifelse } bind >> setpagedevice'\ -\ | pdftk - output - uncompress
  10. ·ͱΊɿ࢖ͬͨςΫ w *NBHF.BHJDLDPOWFSU͸ɺۭͬΆͷ1%'Λు͚Δ w (IPTU4DSJQU͸1PTU4DSJQUͰ1%'ʹֆΛඳ͚Δ w QEGUL͸1%'಺ͷѹॖσʔλΛ৳௕Ͱ͖Δ w ͦͷ݁ՌɺMFTTͱ͔ͰඳըίϚϯυͷத਎͕ݟ͑Δ w

    ্هͷίϚϯυ܈͸TUEJOTUEPVUܦ༝Ͱ1%'Λ΍ΓͱΓ Ͱ͖Δ
  11. ࢀߟ̍ɿ؀ڥ৘ใ w 6CVOUV w *NBHF.BHJDL w (IPTU4DSJQU

  12. ࢀߟ̎ɿ؀ڥߏஙྫ DockerΛ࢖ͬͨྫ • docker run -it -v "$(pwd)/pdf":/pdf \
 ubuntu:16.04

    bash • exitޙͷ࠶ར༻
 docker start -ai $(docker ps -a Ͱݟ͑Δname) • apt update • apt install ghostscript imagemagick pdftk less
  13. ࢀߟ̏ɿ1PTU4DSJQU w 1%'ʹ(IPTU4DSJQUͰֆΛඳ͘
 IUUQTTUBDLPWFSqPXDPNB

  14. %%EOF