もちろん、PDFリアクターでブラウザで処理されたHTMLコンテンツを変換することはもちろん可能です。この場合、たとえば次のようにすることができます。 JavaScript APIを使用して、 "body"要素から抽出したコンテンツをPDFreactorに渡し、結果のPDFを同じページに表示します。下のサンプルスクリプトを参照してください。PDFreactor等D3.js、jQueryの、などの人気のJavaScriptライブラリの様々なサポートとして
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://www.pdfreactor.com/product/wrappers/javascript/lib/PDFreactor.js"></script>
<script>
window.onload = function() {
convertToPDF();
}
function convertToPDF() {
// Create new PDFreactor instance
var pdfReactor = new PDFreactor();
// Get the content from the body element
var content = "<html><body>"+document.body.innerHTML+"</body></html>";
// Create a new PDFreactor configuration object
var config = {
// Specify the input document
'document': content,
// Set a base URL for images, style sheets, links
baseURL: window.location.href,
}
// Render document and save result
pdfReactor.convert(config, function(result) {
document.body.innerHTML += '<iframe id="result" style="width: 100%; height: 95vh"></iframe>';
document.getElementById("result").src = "data:application/pdf;base64," + result.document;
}, function(error) {
document.body.innerHTML += "<h1>An Error Has Occurred</h1>"
+ "<h2>" + error + "</h2>";
});
}
</script>
</head>
<body>
<p>Hello World</p>
</body>
</html>
しかし直接PDFreactorにJavaScriptなど、あなたの入力文書を渡すために、より効率的かもしれませんブラウザでレンダリングされたHTMLを変換するのではなく、Webサービスを使用します。 PDFreactor統合でJavaScript処理(デフォルトでは無効)が有効になっている限り、PDFreactorは入力ドキュメント内のJavaScriptを処理します。