dqf67993 2016-05-22 16:09
浏览 86

使用pdftk-php使用密码保护pdf

I have started using pdftk-php to populate form data into a pdf. Everything is working great. I would like to prompt the person viewing the newly created pdf (which is being viewed in the browser window) to add a password to protect the pdf prior to downloading/saving. I have found the answer to adding passwords to pdfs using pdftk command line commands. However, I do not understand how to execute it in php. I found this line:
pdftk sales_report.pdf output SalesReport.pdf user_pw PROMPT
in the page: https://www.linux.com/learn/manipulating-pdfs-pdf-toolkit. Can anyone tell me how to modify the pdftk-php files to get this to work from within the php environment?

  • 写回答

1条回答 默认 最新

  • doulai1910 2016-05-22 18:58
    关注

    Figured it out. Simple answer. In the pdftk-php.php file go to/around line 73 and locate the passthru() line. Append the end of the line after "output -" to say "output - user_pw $password" $password being the regular text password without the "$". This doesn't prompt for creation of a password but does allow, through php, to create a variable on the page and use that as the password. Worked for my needs.

    评论

报告相同问题?

悬赏问题

  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目