カスタムJavaScriptの実行
IronPDF を使用して、JavaScript コードで HTML コンテンツの外観を簡単に変更できます。 IronPDF は Iron Software の製品ライブラリの一部であり、JavaScript、CSS などをサポートしながら HTML を PDF に変換する強力な機能で知られています。
これを実現するには、まず JavaScript コードを定義します。 In our example, we'll change the text color of all H1 tags to red.
Next, create a rendering options object and set the enableJavaScript property to true. Assign the previously defined JavaScript code to the javascript property within this object.
Utilize the PdfDocument.FromHtml method to render the HTML content into a PDF document. Pass the renderOptions object as the second parameter.
最後に、実行された JavaScript コードの効果 (テキストの色が赤に変更される) が組み込まれた結果の PDF を 'executed_js.pdf' として保存します。
IronPDF やIronBarcode 、 IronOCRなどのその他の Iron Software ライブラリの機能の詳細については、Iron Software の公式 Web サイトをご覧ください。




