2010-05-13

MEMO:CUPS-PDFのTitleで、日本語にする方法

CUPS-PFD で作ったPDFの Title部分が、いつも文字化けしていて、大抵の場合、"_"(アンダースコア)に置き換えられていて、いちいち変更するのが、とっても面倒でした。

で、Google等で調べてみたけどもそれらし い情報も無く、「どうしたもんか。」と思っていました。

で、"/etc/cups/cups-pdf.conf"に何か無いかと見ていたら.....こ れ....かな?

###########################################################################
# #
# Experimental Settings #
# These settings activate experimental options. If you decide to use #
# them I would appreciate any feedback - including an 'ok' if they #
# work as expected - so I can eventually put them into the non- #
# experimental sections. #
# #
###########################################################################

### Key: DecodeHexStrings
## this option will try to decode hex strings in the title to allow
## internationalized titles
## (have a look at contrib/pstitleconv for a suitable filter for data
## from Windows clients)
## 0: disable, 1: enable
### Default: 0

#DecodeHexStrings 0
ここに、"decode hex strings in the title to allow internationalized titles"とあるから、ここでしょう!

Defaultでは、0 (disable)に なっているので、コメントアウトを外して、 1 (enable) に。
DecodeHexStrings 1
そいから、もう一つ、実はこのままだと、長い Tilteの場合、File名になったときに、化けます。
ので、その防止策、先の"Experimental Settings"より前になりますが、

###########################################################################
# #
# Filename Settings #
# #
###########################################################################

### Key: Truncate
## truncate long filenames to a maximum of <Truncate> characters
## this does not consider the full path to the output but only the filename
## without the .pdf-extension or a job-id prefix (see 'Label')
## the minimal value is 8
### Default: 64

Truncate 255

"Truncate"がコメントアウトされていて、Default の "64" を "255" に(因みに、この"255"は根拠レスです。取り敢えず一番大きな数 値) 変更。

そして、CUPSの再起動
sudo /etc/init.d/cups restart
ん で、印刷...PDFっと.....やたっ!

例によって、Before/After

元のTitleがこれ




んで、Before



英字以外化けてます。
で、After



はい、化けてません。
まあ、気になると言えば"|"(縦棒)と、空白 が、"_" になっていることだけど、まあ、許容範囲。
因に、元のTile文字列は、こちら

Gmail、メール文中の画像 挿入がドラッグ&ドロップで可能に | ネット | マイコミジャーナル

なので、再現性は、まずまず。善しとしましょ う。

0 件のコメント:

SSH Keyを作成してGitHubなどに接続してみる - Qiita

大事なことなので。 SSH Keyを作成してGitHubなどに接続してみる - Qiita : GitHubやGitLab上のリポジトリへgitコマンドでファイルをpushする時に、上手く接続出来なかったのでSSH Keyの作成からやり直してみました。これはその作業ログなので自分...