我使用Html2pdf创建Pdf,我不知道如何保存和检索pdf,我是新的PHP请帮助我提前谢谢
我想使用在线工具或html2pdf库将html文件转换为pdf格式.但它转换所有页面但不转换背景图像.
<STYLE type="text/css">
body {margin-top: 0px;margin-left: 0px;
background-image: url(http://162.250.122.195/check/0Certificate_of_Attendance_Form_UNDERLINE_images/0Certificate_of_Attendance_Form_UNDERLINE1x1.jpg);
}
</style>
<html>
<body>
<div>
<h1>Hello world!</h1>
<p><a href="http://www.w3schools.com">Visit W3Schools.com!</a></p>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在使用html2pdf类从html页面生成pdf文件.我想在每个页面上放置列标题.但我没有得到概念如何做到这一点.这是我的代码:
<?php
function linewrap($string, $width, $break, $cut) {
$array = explode("\n", $string);
$string = "";
foreach($array as $key => $val) {
$string .= wordwrap($val, $width, $break, $cut);
$string .= "\n";
}
return $string;
}
if(isset($_POST['download'])){
//connect to the database
require_once('../../connect.php');
$status=$_POST['status'];
//retrieve the specific rows by given status
$query="SELECT *
FROM `incident_status`
WHERE status='".$status."'";
//execute the query
$run=mysql_query($query);
$i=1;
//content to be downloaded
$content='<page backtop="2mm" backbottom="2mm" backleft="2mm" backright="2mm" style="font-size:6pt;bordercolor:#000000;">';
$content .='<p style="text-align:center;"><b>Incident Status Report</b> of the Pending cases </p>';
$content.='<table …Run Code Online (Sandbox Code Playgroud) 我想使用css属性"page-break-after"创建新页面.我已经按照Html2Pdf中的分页符给出了所有步骤但是出现了以下错误.

正如你所看到的......第二页从第一页开始结束开始..我希望第二页从顶部开始.
<?
/*
Template Name: View Form
*/
include_once(ABSPATH."connection/localhost.php");
include_once(ABSPATH."include/cls_forms.php");
include_once(ABSPATH."include/cls_fields.php");
//Authenticate("U");
$oFields = new Fields;
$oForm = new Forms;
$Title = $oForm->getFormTitleByID($_GET['form_id']);
$Content = $oForm->getFormContentByID($_GET['form_id']);
$isPleading = $oForm->getFormTypeByID($_GET['form_id']);
$FieldValues = $oForm->getUserFormFields($_SESSION['user_id'], $_GET['distinct_id']);
foreach($FieldValues as $Name => $Value)
{
$Content = str_replace("«".$Name."»", "<b>".$Value."</b>", $Content);
}
function filterMsWord($Content)
{
$Content = preg_replace("<([A-Za-z0-9\/]*):([A-Za-z0-9-\"=: ]*)>", "", $Content);
$Content = str_replace("<>", "", $Content);
return $Content;
}
if ($_GET['type'] == 'doc')
$Content = str_replace("[---pagebreak---]", '<br clear=all style="mso-special-character:line-break; page-break-before:always">', $Content);
elseif ($_GET['type'] == …Run Code Online (Sandbox Code Playgroud) 我在让html2pdf.js正确给我回调以便我可以将其转换为 base64 字符串时遇到一些问题。
我已经尝试过这个:
html2pdf().from(el).then(function(pdf) {
// pdf is null when I log this...
console.log(pdf);
}).save();
Run Code Online (Sandbox Code Playgroud)
以及许多其他变体,使用output()以下所有内容:
var pdf = new jsPDF();
html2pdf().from(element).set({ pdf: pdf }).toPdf().save();
Run Code Online (Sandbox Code Playgroud)
一切都无济于事。
我目前正在v.0.9.0. 我真正需要得到的是 base64,这样我就可以将其发送回服务器并将其附加到电子邮件中 - 对我来说如何实现这一点并不重要,但我在弄清楚如何使用它时遇到了问题正确回调。
我已经搜索了 github 上的文档和问题。
我正在使用 html2pdf 库将我的网页转换为 pdf。但是,我不知道如何将 pdf 存储在变量中,以便我可以将其发送回服务器。此代码打印一个新的 pdf,但不将值存储到 doc。
var doc = html2pdf(element, {return: true});
Run Code Online (Sandbox Code Playgroud) 我在 vuejs 中有一个项目,我必须使用 vue-html2pdf。
当我在标签中写入文本时:<section>something</section>生成我的 PDF。但是当我在 tag: 中写入时<section><p>something</p></section>,我的浏览器崩溃了。
这是我在 vuejs 中的代码:
<vue-html2pdf
:show-layout="false"
:preview-modal="true"
:paginate-elements-by-height="10"
:filename="test"
:pdf-quality="2"
:pdf-format="size"
:ref="ref"
>
<section slot="pdf-content">
<section class="pdf-item">
<img :src=url>
</section>
</section>
</vue-html2pdf>
Run Code Online (Sandbox Code Playgroud)
还有我下载PDF的功能:
function generateReport() {
this.$refs.html2Pdf.generatePdf();
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试 HTML2PDF javascript。
function createPDF(){
var element = document.getElementById('printMe');
var opt = {
margin: 1,
filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 1 },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
};
Run Code Online (Sandbox Code Playgroud)
当我使用它时,pdf 会进行转换等,但它出现在第一页的中间位置。所有内容都封装在一个div中
<div id="printMe" style="padding: 20px;padding-right:30px;">.....</div>
Run Code Online (Sandbox Code Playgroud)
我尝试设置高度并删除几乎所有内容,但它似乎仍然将其放置在页面中间作为起点。
有没有某种方法可以强制代码从页面顶部开始?
我正在使用html2pdf库,以便从html文件生成pdf.
我不知道如何查看宽度安排.
我有来自source forge的这个库.如果有人有关于它或手册的想法html2pdf?
我有一个包含多行的表,每行都有一个图像.
<table>
<tr>
<td style="">
<img src="<?php echo $img_path; ?>" />
<?php echo ucwords($name); ?>
</td>
<td style="">
<span style="border-bottom: 1px solid;margin-left: 98px;">
<?php echo $date; ?></span>
</td>
</tr>
<tr>
<td>
<?php echo $role; ?>
Signature
</td>
<td style="">
Date
</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
在HTML2PDF中是否可以显示html中显示的图像而不是使用他的内置函数?
我将网页(网址)转换为pdf时遇到问题.一些CSS和JavaScript没有显示我想要的,<.
我尝试了一些开源代码,如:
我想要的最接近的结果是html2pdf.it,但它仍然不够,因为有些CSS没有正确显示.示例html2pdf.it
当我尝试打开pdfcrowd.com时,它会显示我想要的结果.示例pdfcrowd但我们必须支付服务和限制问题.
我试图谷歌搜索如何让它更漂亮,但直到知道我还没有得到答案.>,<
有没有其他类似的开源,或其他我可以为它做的事情?我喜欢他们使用url的概念,所以我可以使用api或触发链接将其与我的其他基于Web的应用程序一起使用.
我有一个页面需要打印为 PDF(另存为 PDF 或仅使用浏览器打印对话框),类似于:
div {
outline: red solid 1px;
}
body {
margin-left: 30vw;
margin-right: 30vw;
}Run Code Online (Sandbox Code Playgroud)
<div>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It …Run Code Online (Sandbox Code Playgroud)