将PDF嵌入网站中,允许用户修改PDF中的可编辑字段,然后保存回服务器 [英] Embed PDF in a website, allow user to modify editable fields in PDF, and save back to the server

查看:117
本文介绍了将PDF嵌入网站中,允许用户修改PDF中的可编辑字段,然后保存回服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Rub on Rails 4.x编写程序,我必须获取具有可填充的已定义字段的PDF文件,填写来自表单提交的数据(此部分已完成!),最后允许用户可以修改服务器上保存的PDF文件,并在修改后覆盖该PDF.

I am writing a Program in Rub On Rails 4.x and I have to take PDF files with defined fields that can be filled out, fill in data from a form submission(This part is DONE!), and lastly allow the user to modify the saved PDF file on the server and overwrite said PDF after making their modifications.

就像我说的那样,我已经获得了通过pdftk表单提交的PDF文件.我现在需要做的是为从过程的第一步生成的服务器上的上述PDF文件提供服务器端编辑功能.

Like I said I have already gotten the PDF files filled out with what has been submitted in the form through pdftk . What I now need to do is provide a server side editing capability to the said PDF files on server generated from the first step of the process.

我见过类似的帖子,但没有人想做我做的同样的事情.如果我错了,链接会很棒.预先感谢您的所有帮助!

I have seen similar posts but none wanting to do the same thing I do. If I am wrong links would be great. Thanks in advance for all your help!

推荐答案

经过大量的挖掘和研究,我发现这是围绕该问题的事实,并实现了一个程序以允许嵌入PDF文件,对其进行编辑,并将其保存回服务器.但是,从我可以看出的事实来看,这个过程将是很棒的,对于Ruby On Rails而言,并没有真正做到这一点.引用@Nick Veys

After lots of digging and research here is what I have found to be the facts surrounding this issue and implementing a program to allow embedding the PDF file, editing it, and saving it back to the server. This process would be great however from what I can tell there is nothing out there that really does this for Ruby On Rails. To quote @Nick Veys

似乎需要找到一个Javascript PDF编辑器,可以将PDF加载到其中,允许用户对其进行修改,并最终将其提交回服务器.似乎它们存在,这是针对ASP项目的

Seems like you need to find a Javascript PDF editor you can load your PDF into, allow the user to modify it, and ultimately submit it back to the server. Seems like they exist, here's one for ASP projects

您是正确的,但从某种意义上来说还是错的,是的,ASP项目有一个,但是它是基于Microsoft的,是的,我知道它可以通过Mono在Linux环境中运行.但是,在这种情况下,似乎确实需要特定于Ruby On Rails的解决方案.

You are correct but still wrong in the sense that yes there is one for ASP projects however that is Microsoft Based, yes I know that it can run on Linux environments through Mono. However to the point it would appear in this instance that a Ruby On Rails specific solution is indeed needed.

我们提出的解决方案如下 1.在Linux存储库(如PDFtk)中使用PDF编辑包 2.然后,呈现一个页面,该页面的一侧嵌入了PDF,并且一个表单表示PDF中的实时字段以接受输入. 3.提交后,您可以使用PDFtk将值写入新的模板PDF文件中,并覆盖以前存储的内容.

The solution that we have come up with is as follows 1. Use a PDF editing package in the linux repositories like PDFtk 2. You then render a page with the PDF embeded on one side and a form representing the live fields in the PDF to take input. 3. Once submitted you use PDFtk to write the values into a new template PDF file and overwrite what was previously stored.

这需要一些额外的步骤来处理数据,而这并不是我真正关心的.但是,这是我们团队可以想到的最佳解决方案,而不会因为一项功能而浪费项目预算.

This requires a few additional steps to process the data than I really care for myself. However it is the best solution that our team could come up with, without bleeding the project budget dry for just 1 piece of functionality.

我希望这对希望在Ruby On Rails中执行相同操作的其他人有所帮助.

I hope this helps anyone else looking to do the same thing in Ruby On Rails.

这篇关于将PDF嵌入网站中,允许用户修改PDF中的可编辑字段,然后保存回服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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