ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => ข้อความที่เริ่มโดย: Fallen ที่ 22 ตุลาคม 2022, 15:22:55



หัวข้อ: ทำไม Print Text ใน Form เป็น pdf ข้อความไม่มา (มือถือ) มีโค๊ดให้ดู
เริ่มหัวข้อโดย: Fallen ที่ 22 ตุลาคม 2022, 15:22:55
หาข้อมูลหลายชั่วโมงมาก ยังไม่เจอวิธีแก้เลยครับ
ใช้กับ PC ได้ แต่กับ มือถือไม่ได้
 :wanwan004:

โค๊ด:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<body>
<div id="PDF">
<input type="Text" size="27%"/><br>
<input value="m" type="radio">male
<input value="f" type="radio">female<br>
<textarea  name="content" cols="50%" rows="2"></textarea>

</div>
</body>
<button id="print" onclick="printContent('PDF');" >print</button>
<script>
function printContent(el){
var restorepage = $('body').html();
var printcontent = $('#'   el).clone();
$('body').empty().html(printcontent);
window.print();
$('body').html(restorepage);
}
</script>