How do I access PDF form fields with python - python

I need to automatically save pdf form fields to a database and write some of them later to new forms I am sending out. I can save the fields no problem but I don't know how to write to a PDF form field .. I am using pdf miner but I can't find anything in it to do this.
Can any one point me in the direction of a solution?

Reports labs has a open source PDF kit that let you write PDFs, including form fields http://www.reportlab.com. They also have commercial product the reads PDFs. But I've only used the open source version.

I've never used it, but people seem to like PyPDF

Related

How can I create a downloadable VrCard on my flask web page?

I would like to create a vcf file on my website that users can download and add the file info to their contacts on their mobile phones.
So far I have made this:
Download
When I click the link it downloads a vcf file. When I open it, it redirects me to my contacts app and throws me this error: "No importable cards were found." That´s because I haven´t set any information in any VCard. I would like to know how can I set/create a VCard with the information I have in my SQLAlchemy database (name, email,phonenumber,website,etc.) Thanks in advance
I had to solve this problem recently for work. Here is how I did it!
The broad strokes: Created a Jinja2 template based on my team's needs for vcard output, a data model to lay over the template, a service to render the template from the database query, and finally, using io.BytesIO and flask.send_file to transmit the data in file format to the user.
The gist linked above doesn't have the more contextual parts of the implementation, but does provide an example of how to wire up flask to do this.
Edit: I evaluated the vobject library that i found recommended, but I honestly didn't think it was intuitive to use or very pythonic, meaning it wasn't something I wanted to depend on in my code base. However, maybe it'll work better for you (or others).

How do I upload and manipulate excel file with Django?

Ok,
I had a look at the UploadFile Class documentation of the Django framework. Didn't find exactly what I am looking for?
I am creating a membership management system with Django. I need the staff to have the ability to upload excel files containing list of members (and their details) which I will then manipulate to map to the Model fields.
It's easy to do this with pandas framework for example, but I want to do it with Django if I can.
Any suggestions.
Thanks in advance
you can use xlrd to read excel files
in client side you just submit a form with file input.
on server uploaded file stored on request.FILES
read file and pass it to xlrd then process sheets and cells of each sheet

Export PDF with pre-filled and unfilled editable fields

I am trying to print out custom commercial invoices based on a known set of data and allowing for an unknown set of data. My known data includes addresses, general contact information, etc.
What I want is to be able to use a PDF template of a "commercial invoice" and have the known data auto-populated into the form where available. Then, the user can download the (incomplete) PDF and fill in the empty / optional form fields using their own collection of information - stuff like Tax ID, recipient care-of names, internal tracking ids, etc.
How can I use JSON / XML + python + HTML + a PDF template to auto-fill some info and leave some info empty, on an editable PDF form?
Thanks!
You essentially want server-side filling of the form.
There are several possible approaches.
An industry-strength approach would be using a dedicated application which could be called via command line (FDFMerge by Appligent comes to my mind, which is very easy to integrate, as all you'd have to do is to assemble the FDF data, and then the command string).
Another approach is to use one of the PDF creating libraries out there (iText, pdflib or Adobe's PDF Library come to my mind here). In this case, you have considerably more programming effort, but may have somewhat more flexibility.

save binary fields to folder?

I would like to use binary fields in openerp, but instead of save them to the database as usual, I'd like to save to file system (folder). I could use a char field to store the path but, is there a way to implement the upload and download for it?
Thanks
A module which was developed in version 6 may help you to select path for saving files instead of storing in db as binary.
check out web gallery module

OpenERP 6.1 module with upload file field

I want to create OpenERP 6.1 module with a upload binary file field as one of the fields in view.
The file will be stored in database as binary data, but before storage in database I need to parse that file, and save data as part of the other created module.
So, I don't know how to specifiy filed for upload files in a view xml file, and also how to run the uploading process. Can somebody help me about this? Some code snippets or advice how to do that.
Take a look at the way the attachments module works, particularly the binary data column. You should also look at the screen definition.

Categories