How to convert MySQL data from page into PDF

老子叫甜甜 提交于 2019-12-25 04:07:48

问题


I want to convert data that I retrieve from mySQL database into PDF on image click. I want to place image on each article from my website, and when someone click on that image, automaticaly gets pdf version of the article. How can I do that? Please help me.

For retrieve data from MySQL I use this:

<?php
$id = (int)$_GET['vij'];
$sql="SELECT id,news_title,news_text,publish_date,hit_count FROM news WHERE id=$id";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
?>

and then call:

<? echo $rows['news_text']; ?>

回答1:


You could try TCPDF - a PHP class, that does not require any additional libraries. There are a lot of examples which are quite easy to use. It supports UTF-8, and has a lot of other features. Just visit the site.



来源:https://stackoverflow.com/questions/17723463/how-to-convert-mysql-data-from-page-into-pdf

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