5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ローカルファイルのPDFをページ指定して開きたい

Posted at

PDFの指定ページを開きたい

理由は言えないけど開きたいことってあるじゃない。
大人だもの。
それがたまたまPDFで、しかもページ指定したいってだけ。

普通にPDFを開いてみた

関連付けられたAcrobat Reader DCで開いたよ。
当然だよね。でも開くだけじゃダメなんだ。
ページ指定したいんだ。

コマンドラインオプションでやってみた

AcroRd32.exe /A page=10 test.pdf

ほら。できた。あっけなかったねおめでとう。

と、おもったけど

Acrobat開いたままで指定ページを変えてもう一度実行したら
ページは切り替わらなかった!
だめだーこんなんじゃないんだー

そもそもShellExecuteで動かしたいもんで

うーんどうしようかな

結局

Chromeを使うと「file://」が使えるのでそのままURLとして扱えました。
なのでURLの後ろに「#page=10」とつけてURLを引数として呼び出すようにした
Chromeは毎回違うタブで開くのでページは切り替わってよかったなー
(タブが増えていくのは目を瞑る…)

ファイルパスに日本語が

日本語が含まれているときはURLをエンコードして上げる必要があるわね

IEはだめだった

IEは「file://」が使えないし、どうも「Acrobat Reader DC」をそのまま呼んでる感じなのかな?コマンドライン引数も使えないし。もー

5
8
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
5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?