文字とPDFとPDFKit

2377be1c3f33751ea7c73a7bd8d58996?s=47 T. MOTOOKA
September 08, 2019

 文字とPDFとPDFKit

macOSのPDFKitで取れる文字について。

2019.09.08 at macOS native Symposium #5
https://macos-native.connpass.com/event/138153/

2377be1c3f33751ea7c73a7bd8d58996?s=128

T. MOTOOKA

September 08, 2019
Tweet

Transcript

  1. จࣈͱ1%'ͱ 1%',JU CZ5.0500," BUNBD04OBUJWF4ZNQPTJVN https://macos-native.connpass.com/event/138153/

  2. "CPVUUIF4QFBLFS w 5.0500,"!U@NPUPPLB w $3.ͱ͔࡞ͬͯΔਓ w ͳ͔ͥ࢓ࣄͷଟ͘Ͱ1%'ʹؔΘΔ w ׽ࣈ5BML ೥

    ͔Βͷ
 .BDϢʔβɾΞϓϦ։ൃऀʢϒϥϯΫ௕Ίʣ w ࡞Δ.BDΞϓϦ͸ࣗ෼ઐ༻ͷ΋ͷ͹͔Γ w ."4৹ࠪʹ௨Βͳ͍΋ͷ͹͔Γ
  3. ࠷ۙग़ͨ͠ΞϓϦ $IBS7JFXFS BWBJMBCMFPO.BD"QQ4UPSF

  4. None
  5. ໨࣍ w 1%'ϑΝΠϧͷதͷจࣈ w 1%',JUͰऔΕΔจࣈ w 5P6OJDPEF.BQΛา͘

  6. 1%'ϑΝΠϧͷதͷจࣈ w ϥελը૾ w ಡΉʹ͸0$3ٕज़͕ඞཁ w ϕΫλը૾ʢΞ΢τϥΠϯԽ͞Εͨจࣈʣ w ͜Ε΋0$3ٕज़͕ඞཁ w

    ςΩετඳըίϚϯυͰॻ͔Εͨจࣈ w ʮී௨ʹʯಡΊΔͷ͸ɺ͜Ε͚ͩ
  7. 1%'ͷςΩετඳըίϚϯυ w ࠲ඪΛࢦఆͯ͠ w ϑΥϯτ΍αΠζΛࢦఆͯ͠ w จࣈྻΛࢦఆͯ͠ɺඳ͘

  8. ςΩετͷจࣈίʔυ w ϑΥϯτͷʮαϒηοτຒΊࠐΈʯ w จࣈͷඳըίϚϯυ͸ɺαϒηοτதͷจࣈͷ*%Λࢦ͢ w ʮʯ͸ʮ͋ʯɺʮʯ͸ʮ͍ʯͱ͍ͬͨײ͡ w ඳըίϚϯυͰඳ͔ΕΔจࣈ͕ɺ
 6OJDPEF্ͷԿͳͷ͔Θ͔Βͳ͘ͳΔ

    w 5P6OJDPEF.BQʢৄࡉ͸ޙड़ʣ w ʮςΩετΛಡΉʯܥͷಈ͖͸ɺେ఍͜ΕΛ࢖ͬͯΔ
  9. ໨࣍ w 1%'ϑΝΠϧͷதͷจࣈ w 1%',JUͰऔΕΔจࣈ w 5P6OJDPEF.BQΛา͘

  10. 1%',JUͰऔΕΔจࣈ w จࣈྻશମʢ1%'ϑΝΠϧશମPSࢦఆͨ͠ϖʔδશମʣ w Oจࣈ໨ͷ/43FDU w ࢦఆͨ͠/41PJOU͕Կจࣈ໨ͷจࣈΛࢦ͢ͷ͔ʁ

  11. 1%',JUͰऔΕΔจࣈ σϞ 1MBZ(SPVOEʹू߹ ιʔείʔυ https://gist.github.com/motooka/b826fe7ef534ab42f0b3b83567af8d97

  12. ࢼͨ͠จࣈ w ͜ͷ݁Ռ͸ɺ1%'࡞੒ϓϩάϥϜͷ࢓༷ʹԠͯ͡มΘΓ·͢ʂ w ͜͜Ͱ͸ɺ.48PSEͷ1%'ΤΫεϙʔτػೳͰͷྫͰ͢ɻ w ୙఺ɾ൒୙఺ΛؚΉจࣈʮύεϫʔυʯ w /'%ਖ਼نԽ͞Εͨঢ়ଶͰऔΕΔʢͪͳΈʹ5P6OJDPEF.BQͰ͸/'$ਖ਼نԽʣ w

    65'Ͱ4VSSPHBUF1BJSʹͳΔֆจࣈʮʯ6 '" w ͦͷ··औΕΔ w ;8+ ;FSP8JEUI+PJOFS Ͱܨ͛ͨֆจࣈ
 ʮ$ʯ8PNBO ;8+ 8PNBO ;8+ (JSM w औΕͳ͍ʢԽ͚Δʣ w ҟମࣈηϨΫλ෇͖ʮ❄ʯ6  6 &'' w ҟମࣈηϨΫλ͕ൈ͚མͪͯʮ❄ʯʹͳΔ
  13. ໨࣍ w 1%'ϑΝΠϧͷதͷจࣈ w 1%',JUͰऔΕΔจࣈ w 5P6OJDPEF.BQΛา͘

  14. )VNBO3FBEBCMF1%' w 1%'͸όΠφϦͰ͋ΓςΩετͰ͋Δ w 5P6OJDPEF.BQ౳͸௨ৗ͸ѹॖ͞Ε͍ͯΔ w )VNBO3FBEBCMFͰ͸ͳ͍ w ৳௕͢Ε͹)VNBO3FBEBCMFʹͳΔ

  15. QEGUL w 1%'ϑΝΠϧΛՃ޻ͯ͘͠ΕΔπʔϧ w 1%'ϑΝΠϧ಺ͷѹॖ෦෼ͷ৳௕΋Ͱ͖Δ w ΊͬͪΌݹ͍ w :PTFNJUF·Ͱ͸ී௨ʹಈ͍ͨ w

    ඇެࣜϏϧυͰ͸.PKBWFͰ΋ಈ͘Β͍͚͠Ͳා͍ w 6CVOUVͳΒެࣜϏϧυ͕࢖͑Δ w ͸μϝ
  16. QEGULΛ%PDLFSͰ࢖͏ w docker run -it --rm --mount type=bind,source="$ (pwd)/work",dst="/work/" ubuntu:16.04

    bash w ΧϨϯτσΟϨΫτϦ಺ͷʮXPSLʯΛϚ΢ϯτ w ࠶ར༻Λߟྀ͠ͳ͍ߏ੒ w apt update; apt install -y pdftk w QEGULΛΠϯετʔϧ w pdftk test1.pdf output - uncompress > test1.1.pdf w QEGULͰ1%'ϑΝΠϧ಺༰Λ৳௕
  17. 5P6OJDPEF.BQΛಡΉ w )VNBO3FBEBCMFͳ1%'ΛςΩετΤσΟλͰ։͘ w ʮ5P6OJDPEFʯͰݕࡧ w ʮ3ʯͱॻ͍ͯ͋ͬͨΒʮ?ʯͰݕࡧ w ͦΕͰݟ͑ͨ΋ͷ͕5P6OJDPEF.BQͷ࣮ଶ w

    CFHJOCGDIBS΍CFHJOCGSBOHF͕.BQຊମ w 6OJDPEFଆʢӈଆʣ͸େ఍͸65'#&
  18. 5P6OJDPEF.BQΛಡΉ σϞ

  19. ໨࣍ w 1%'ϑΝΠϧͷதͷจࣈ w 1%',JUͰऔΕΔจࣈ w 5P6OJDPEF.BQΛา͘

  20. ·ͱΊ w จࣈͷඳըํ๏ʹΑͬͯऔΕͳ͍จࣈ΋͋Δ w ϥελը૾౳ w จࣈ͕औΕΔඳըํ๏Ͱ΋ɺऔΕͳ͍จࣈ΋͋Δ w 5P6OJDPEF.BQͰਖ਼ࣔ͘͠͞Εͳ͍จࣈ w

    ࠲ඪͷߟ͑ํɿࠨԼݪ఺ͰEQJͷ࠲ඪܥ w )VNBO3FBEBCMF1%'
  21. ࢀߟࢿྉ w 1%'ߏ଄ղઆʢॻ੶ʣ
 +PIO8IJUJOHUPOஶଜ্խষ༁ w 1%',JU
 IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOQEGLJU

  22. 2"

  23. ׬