2

私は次の2つの方法を試しました..

<embed src="assets/pdf/mypdf.pdf" id="Pdf1" name="Pdf1" hidden="true">

<a class="print" onClick="document.Pdf1.printWithDialog();"></a>

<a onClick="document.getElementById('Pdf1').printWithDialog()" style="cursor:hand;">Print file</a>

別の試み..

<script type="text/javascript">
function printPDF(pdfUrl) 
{
    var w = window.open(pdfUrl);
    w.print();
}
</script>

<a class="print" onClick="printPDF("assets/pdf/mypdf.pdf");">a</a>

どれも機能していないようです。リンクをクリックしてPDFを印刷ダイアログに送信できるようにするための解決策はありますか? window.print は、pdf ではなく、ダイアログに実際のサイトを表示するだけです。

4

0 に答える 0