0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PegaでPDF出力する(日本語)

Last updated at Posted at 2025-10-14

はじめに

前回の記事 は簡単にPDFを出力できることを確認しました。まだ日本語が表示できませんでしたので、日本語の表示をできるようにしてみます。

この記事は Pega Platform 24.2 をベースに記載しています。

カスタムフォントをアップロードする

  1. IPAのサイトから IPAexゴシック(Ver.004.01) フォントをダウンロードする
    https://moji.or.jp/wp-content/ipafont/IPAexfont/ipaexg00401.zip
  2. ダウンロード後、zipファイルを展開する
  3. Dev Studioで、Create > Technical > Binary File
  4. Create Binary File タブで、以下を入力する
    例)
    Label: IPAex Gothic Font
    App Name (Directory): webwb
    File Type (extension): ttf
  5. Create and open をクリックする
  6. Edit Binary File フォームで Upload file をクリックする
  7. Upload file ダイアログボックスで Choose file(ブラウザーによって、ファイルの選択、参照など) をクリックし、フォントファイル(ipaexg.ttf)を選択し、Upload file をクリックする(ここでは、アップロードが完了しても画面にファイル名は特に表示されない、Download file が押せる状態になる)
  8. Save をクリックする

(参考)
Uploading custom font files

OOTBのPDF cssを調整する

  1. Dev Studio の検索ボックスで pyCompactStylesforPDF テキストファイルを検索して開く。初期の内容は以下の通り。

    /*
    Any style modifications/additions on top of pxCompactStylesForPDF(Final Rule) can be added in this file. 
    */
    
    #{}
    
  2. チェックアウトする。ただし、今回は Private edit で試した。

  3. Main タブで内容を編集する。

    /*
    Any style modifications/additions on top of pxCompactStylesForPDF(Final Rule) can be added in this file. 
    */
    
    #{}
    @font-face {
    	font-family: "Helvetica";
    	src: url("webwb/ipaexgothicfont.ttf") format("ttf");
    }
    
  4. Save する

  5. チェックインする。

(参考)
Adjusting the out-of-the-box PDF compact style sheet
Generating PDFs from your UI

CSSを有効にする

  1. Dev Studio の検索ボックスで UseCompactStylesforPDF DSS(ダイナミックシステム設定)を検索して開く
  2. Setting タブで、value に true を入力して、Save する

(参考)
Adjusting the out-of-the-box PDF compact style sheet

ケースを実行する

前回の記事 のケースを再度作成します。「Create PDF」オートシェイプでは、フォント指定ができないので、今回 css には Helvetica を指定しました。(これはスマートな方法ではないですね)

pega-pdf-sample-6.png

おわりに

Pegaで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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?