在新标签页中打开FPDF [英] Open FPDF in new tab

查看:56
本文介绍了在新标签页中打开FPDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从邮寄表格生成的pdf文件(fpdf).我希望pdf在新的标签页和/或窗口中打开,提示用户保存pdf.我猜我需要将输出保存到字符串

I have a pdf generated (fpdf) from a post form. I would like the pdf to open in a new tab and/or window prompting the user to save the pdf. I'm guessing I need to save the output to a string

$data=$pdf->Output("OfficeForm.pdf", "S");

但是我要如何使用此字符串才能在新窗口中打开它.我已经尝试过类似的操作,但无法正常工作.我是在正确的轨道上还是window.open不是我所需要的?

but what exactly can I do with this string to get it to open in a new window. I've attempted something like this but it's not working. Am I on the right track or is window.open not what I need?

echo "<script type=\"text/javascript\">      
window.open('$data', '_blank')    
</script>";

推荐答案

如果您使用表单,则可以通过在-tag中指定target ='_ blank'来完成(在您应该拥有Submit ='something'的位置旁边)

If you use a form you can do it by specifying target='_blank' in the -tag (next to where you should have submit='something')

示例:

这将在提交时打开一个新的选项卡(显示"makepdf.php"产生的内容).

This will open a new Tab (showing whatever "makepdf.php" produces) on submit.

希望它能正确回答问题

这篇关于在新标签页中打开FPDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆