首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >php/wordpress:如何在政府pdf表单上“叠加”数据?

php/wordpress:如何在政府pdf表单上“叠加”数据?
EN

Stack Overflow用户
提问于 2014-11-04 23:39:02
回答 2查看 174关注 0票数 0

我有一个Wordpress网站。我想允许用户下载(和/或打印)一份政府发布的表格(pdf格式),该表格已经填满了从网站数据库中提供的数据(如姓名、地址、支付金额等)。

在编码php之前,有没有Wordpress插件可以做到这一点(我是Wordpress的新手)?顺便说一下,我已经有了重力表单。

EN

回答 2

Stack Overflow用户

发布于 2014-11-04 23:53:33

我不知道Wordpress,但在PHP中使用FPDFFPDI可以非常简单地做到这一点。

代码语言:javascript
运行
复制
<?php

require_once('fpdf.php');
require_once('fpdi.php');

$pdf = new FPDI();

// get the page count
$pageCount = $pdf->setSourceFile('base.pdf');
// iterate through all pages
$pageNo = 1;
// import a page
$templateId = $pdf->importPage($pageNo);
// get the size of the imported page
$size = $pdf->getTemplateSize($templateId);

// create a page (landscape or portrait depending on the imported page size)
if ($size['w'] > $size['h']) {
    $pdf->AddPage('L', array($size['w'], $size['h']));
} else {
    $pdf->AddPage('P', array($size['w'], $size['h']));
}

// use the imported page
$pdf->useTemplate($templateId);

// set the font typeface and size
$pdf->SetFont('Helvetica');
$pdf->setFontSize(20);


// set position where to write
$pdf->SetXY(10, 10);
$pdf->Write(8, 'Hello World!');

// don't save a local copy, but instead output stream to the browser
$pdf->Output("output.pdf", "I");
票数 1
EN

Stack Overflow用户

发布于 2014-11-05 00:07:38

看一下:https://wordpress.org/plugins/gravity-forms-pdf-extended/

在用户提交重力表单时保存PDF文件,以便可以将其附加到notification

  • Customise PDF模板,而不会影响核心重力表单Plugin

  • Multiple PDF Templates

  • Custom MERGETAGS

  • View
  • 输出模板中的单个表单域,并通过管理员界面或在用户提交其表单后下载
  • Works with Gravity Signature Add- on
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26739118

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档