How to use Wkhtmltopdf converter with filled text boxes?

柔情痞子 提交于 2019-12-06 08:14:44

wkhtmltopdf renders an HTML page it "sees", not how the browser displays it. When you fill out the form, the values in the fields are not part of the underlying HTML structure (though they are part of the DOM). As a work-around, you can do the following:

  1. Capture and save all of the form parameters' values somewhere (session, file, database, etc) when the form is submitted.

  2. Generate a new HTML page using the same code as the form page.

  3. Fill in the form values you had saved directly into the HTML code. In other words, specify the value attributes on the form with the inputs you captured.

    For example, if you have a text field called customer_name and the user submitted John Doe, hard-code the value into the tag:

    <input type="text" name="customer_name" value="John Doe">
    

Now wkhtmltopdf can render the form with the values filled out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!