LoginSignup
0
0

pdf2htmlEXがbrewで使えなくなっていたのでDockerで使ってみた

Last updated at Posted at 2023-09-20

はじめに

以前使っていたpdf2htmlEXbrewで入らなくなっていました。

% brew install pdf2htmlex
(中略)
Warning: No available formula with the name "pdf2htmlex". Did you mean pdf2image?
==> Searching for similarly named formulae and casks...
==> Formulae
pdf2image

To install pdf2image, run:
  brew install pdf2image

調べてみるとメンテナーが変わって、開発環境がないためhomebrewのビルドスクリプトを開発できないとのことでした。

仕方ないので、代わりにDockerで使えるようにしてみました。すご〜く簡単です。

セットアップ

Dockerのインストール

インストール方法はお任せします。今回はDocker Desktopを用います。

Dockerhubからイメージをpull

Dockerhubにイメージがありますのでpullしてきます。:latestを指定するとうまく落ちなかったので、最新のタグをつけてpullしました。

docker pull pdf2htmlex/pdf2htmlex:0.18.8.rc2-master-20200820-alpine-3.12.0-x86_64

実行

早速実行してみました。簡単です。

docker run -ti --rm -v "`pwd`":/pdf -w /pdf pdf2htmlex/pdf2htmlex:0.18.8.rc2-master-20200820-alpine-3.12.0-x86_64 --zoom 1.3 <input>.pdf

入力ファイルと同じディレクトリに同じファイル名のhtmlが書き出されます。

エイリアスを張る

毎回このコマンドを入力するのは大変なので、エイリアスを設定します。

alias pdf2htmlEX='docker run -ti --rm -v "`pwd`":/pdf -w /pdf pdf2htmlex/pdf2htmlex:0.18.8.rc2-master-20200820-alpine-3.12.0-x86_64'

これで、pdf2htmlEX <input>.pdfと実行するだけでHTMLファイルが作成できます。必要に応じてpdf2htmlEX --zoom 1.3 <input>.pdfのようにオプションも利用できます。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0