Embed PDF in a website, allow user to modify editable fields in PDF, and save back to the server - ruby-on-rails

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.
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!

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
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
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.
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.
I hope this helps anyone else looking to do the same thing in Ruby On Rails.

I have done something like this using my company's .NET product. It can also be done using its Java version too.
http://www.gnostice.com/nl_article.asp?id=255&t=Save_Form_Submit_Data_Back_To_Original_PDF_Document_In_NET

Related

Contour Attachments not being sent

This is my first go-round with Contour and I really like it! I am stuck on one thing and hoping someone out there has some insight.
I have a simple 4 field form, nothing required, no rules...one of the fields is a file upload field. It renders and works correctly on the form, but when I recieve the email with the form values, it does not include a link to the file, or a file attachment. The attachment is also not shown in the "Entries" tab. I tried installing Contrib which seems to have more support for attachments, but I still did not get any mention of the uploaded file in my email.
I am wondering if there is anything I have to do in the config, or similar to allow sending attachments.
I am running Umbraco v6.0.6 and Contour 3.0.14, Contrib is currently uninstalled. I am adding the Razor Macro the page, not the UserControl.
Thanks
Going to answer my own question here in case someone else runs up against this.
Out of desperation I decided to just start trying anything I could think of, so I tried adding the Contour form to my page as a UserControl (despite what I had read) instead of as a Macro, when I did that, I started receiving the attachment link text in my email so I re-installed Contrib and boom, attachments are on the email now.
SO, in summary, you need Contour (obviously), need the Contour Contrib package, and you need to add the macro as a user control and not as razor in order to send attachments

Using Your Own Text Editor On a Server

Are there any hosting providers which allow you to use your own text editor to edit hosted files? At the moment, I'm using Namecheap and I can only edit hosted files through their code editor which means I need to edit the files locally and then upload them if I want to use my own text editor. I'd really like to develop a site directly on the server so skipping this step would save quite a bit of time.
Specifically, I'd like to use Sublime Text 2. Google didn't help so I'm hoping someone hear could point me in the right direction.
Thanks.
It looks like EasyEditors might have what you need. It appears that you can edit the files on their site.

Is there a clever way to pass a yml locale file to my client for translation?

I have finished a rails project using i18n and now I need to pass all the text in the website to our client so that he can translate them and we can include additional locales to our app.
The problem is our client is not a geek and if we give them the actual YAML file, they will use MS Word to edit it and we'll lose all the proper markup in the process ("\n" for new lines, one line text, etc...).
How would you handle this process?
Is there a better way than giving the client a .doc file and then loosing a day to clean the text afterwards and manually converting it back to YAML?
Thanks in advance,
Augusto
This is exactly what Locale was created for : you upload your YAML files, your client/translator edits the content and you sync YAML back down. You don't email files and you don't have to deal with crappy file formats - check it out!
Full disclosure : I co-founded and develop Locale.
This sounds like a one-off thing where I you do the translation once and then be done with it.
What we do in these cases (we usually work with a Translator for these kinds of things) is that we export all the keys in the YAML to Excel and send them that.
Once we get it back we usually task a intern with fixing up the yaml (after it's been translated back into YAML - we do this manually at the moment but a little script should be easy to implement)
Other solutions could be (if you do this a lot) that you include the translations into your app and enable through some JavaScript and maybe something similar to Aloha Editor the user to simply click on texts and translate them in the app. But that's a bit excessive and only makes sense if there are really a lot of translations to be done and you want to crowdsource them (Facebook did this back in the day)

How do I simply send my rails website to my designer so he can finish the design?

Basically I need to send to my designer a non-finished rails website.
My Designer doesn't have ruby / Rails environnement installed and should be able to:
modify the CSS
add some html elements
I can manually check the diff after he worked.
Is there a way that I can make an easy extraction of my app or giving an access to the deployed one with capacity to re-root the css from his files?
Based on your question, your designer, in addition to the design, also writes code: he creates css files, and edit your views files. That makes him an integrator.
As such, he should learn the basics of source control management, such as git, svn or any system you prefer (my favorite is Bazaar, for its simplicity).
It is a best practice that will allow you to save some time and avoid a lot of headaches when merging your revisions. A nice side effect: he will be able to easily roll-back to a previous working version of the code, should anything bad have happened.

Easy way to find a view file in rails?

I develop rails applications with my designer who has minimum knowledge about rails.
She works on Windows through file-sharing from a Linux server.
She always has hard time finding view files to work on.
I usually use 'grep' to find a view file.
But she can't.
If you have a good suggestion, please share with me.
I have an idea which may be overkill.
Is there a way to automatically add comments around view files (including layouts and partials?) in html file?
Like this:
<!--Starting app/views/some_dir/some_file.html.erb-->
HTML here...
<!--Ending app/views/some_dir/some_file.html.erb-->
This way, my designer can find the file very easily.
Of course, this should be automatic and development environment only.
Thanks.
Sam
I use the Rails Footnotes gem (https://github.com/josevalim/rails-footnotes) in some of my projects which allows me to click a link in the footer of my app that opens the current view (also shows partials) in TextMate. Not sure if it could be customised to work with a Windows text editor but you could look at the URL to work out the file name.
I.e to open a file in MacVim, it creates the following link:
mvim://open?url=file:///Users/steveholt/Sites/foo/app/views/projects/log.html.haml
and for TextMate:
txmt://open?url=file:///Users/steveholt/Sites/foo/app/views/projects/log.html.haml

Resources