Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
509 views
in Technique[技术] by (71.8m points)

javascript - 使用Print.js库,我希望图像作为标题出现在每个页面中(Using Print.js Library i want image as a header to be appeared in every page)

I am using print.js library to print the pdf.

(我正在使用print.js库来打印pdf。)

I want an image to be appearing on header of every pdf page.

(我希望图像出现在每个pdf页面的标题上。)

I am using header attribute like this: printJs({printable: 'printJS-form', type: 'html', header: '<img src = 'intro.js'/>) but it only prints text and not the image.

(我正在使用这样的标头属性: printJs({printable: 'printJS-form', type: 'html', header: '<img src = 'intro.js'/>)但它仅显示文本,而不显示图像。)

As well as i want an image in the as a footer of each pdf page.

(以及我想要的图像作为每个pdf页面的页脚。)

How to acheive both using printjs.

(如何使用printjs实现两者。)

I am not using any framework jsut plain html,css and js

(我没有使用任何框架jsut纯html,css和js)

Below is my html file

(以下是我的html文件)

  <!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href=" https://printjs-4de6.kxcdn.com/print.min.css">
    <link rel="stylesheet" href="style.css">
    <script src="https://printjs-4de6.kxcdn.com/print.min.js"></script>
  </head>
  <body>
    <form method="post" action="#" id="printJS-form">
      <h1 class="display">
        VALUATION FORM
      </h1>
      <div>
                    <div>
                        <div>
                            <label for="refValueInput" class="control-label">Client</label>
                            <input id="refValueInput" required="" class="form-control" placeholder="Enter Client Name." maxlength="255" type="text" tabindex="2">
                        </div>
                    </div>

<div class="display">
  <p style="margin-left:135px;">1. &nbsp; &nbsp; &nbsp;Purpose for which valuation is made :</p>
<span>To Find out the value of the property for the financial</span>
<p id="mar">Institution for the Loan Purpose.</p>
</div>

 </form>
      <button type="button" onclick="printJS({ printable: 'printJS-form', type: 'html', header: '<header><img src = 'intro.jpg'/></header>'})">
     Print Form with Header
  </button>
  </body>
</html>
  ask by SAMAR translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...