選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

custom-print.js 528B

123456789101112131415161718192021
  1. function printPdf(url, title) {
  2. if (title) {
  3. document.title = title;
  4. }
  5. const iframe = document.createElement('iframe');
  6. iframe.style.visibility = 'hidden';
  7. iframe.style.position = 'absolute';
  8. iframe.style.width = '0';
  9. iframe.style.height = '0';
  10. iframe.src = url;
  11. document.body.appendChild(iframe);
  12. iframe.onload = function () {
  13. try {
  14. iframe.contentWindow.print();
  15. } catch (e) {
  16. console.error('Error printing PDF:', e);
  17. }
  18. };
  19. }