Wordpress の投稿内のコンテンツから動的に PDF を作成したいと思います (以下では少し簡略化されています)。 「レシピ」と呼ばれるものは、 DOMPDFdiv
に送信したいものです(投稿全体ではありません)。
<div class="post"> <div> <!-- some stuff I don't want in the PDF --> </div> <div class="recipe"> <?php more_fields('recipe-name'); ?> <?php more_fields('recipe-method'); ?> <a href="<?php /*something here that calls DOMPDF, delivers the contents of #recipe, and causes render and stream of PDF to browser.*/ ?>" class="print-recipe">Get a PDF of this recipe.</a> </div> </div>
これまでPHPライブラリを使用したことがなく、これを行う方法が欠けているようです。ドキュメンテーションはこちら。喜んで手伝ってくれる人に前もって感謝します。