Is encryption exposed in pisa at all? - python

I need to be able to allow a user to save and preview a PDF file, but
not print it. The reportlab instructions seem pretty
straightforward, but I didn't see it in the docs for pisa.
Thanks!

Previously I was using POD Appy Framework. It is very ease and clean to handle. You can check the document http://appyframework.org/pod.html

Related

Import data from excel spreadsheet to django model

I'm building a website that'll have a django backend. I want to be able to serve the medical billing data from a database that django will have access to. However, all of the data we receive is in excel spreadsheets. So I've been looking for a way to get the data from a spreadsheet, and then import it into a django model. I know there are some different django packages that can do this, but I'm having a hard time understanding how to use these packages. On top of that I'm using python 3 for this project. I've used win32com for automation stuff in excel in the past. I could write a function that could grab the data from the spreadsheet. Though what I want figure out is how would I write the data to a django model? Any advice is appreciated.
Use http://www.python-excel.org/ and consider this process:
Make a view where user can upload the xls file.
Open the file with xlrd. xlrd.open_workbook(filename)
Extract, create dict to map the data you want to sync in db.
Use the models to add, update or delete the information.
If you follow the process, you can learn a lot of how loading and extracting works and how does it fits with the requirements. I recommend to you first do the step 2 and 3 in shell to get more quicker experiments and avoid to be uploading/testing/error with a django view.
Hope this kickoff base works for you.
Why don't you use django-import-export?
It's a widget that allows you to import excel files from admin section.
It's very easy to install, here you find the installation tutorial, and here an example.
Excel spreadsheets are saved as .csv files, and there are plenty of examples and explanations on how to work with them, such as here and here, online already.
In general, if you are having difficulty understanding documentation or packages, my advice would be to search for specific examples or see if whatever you are trying to do has already been done. Play with it to get a working understanding, and then modify it to fit your needs.

What python modules should I use to edit a word document then turn it to a pdf?

I want users to be able to create the report template in Microsoft Word, I'll then probably add document fields. Then the script evaluates a number of things adds the appropriate text to the fields then creates a pdf of the filled in form.
So which modules would be best for this? I've looked at reportlab but I need to work from a pre-generated template and that doesn't seem feasible.
If you will use it only under Windows, having Word installed you could use PyWin32 that lets you access the api of the suite. You could also try IronPython as suggested here.
If you need to read a docx template regardless of the platform you could try this outdated extension.
If it suits your application to use a cloud service to populate Doc/DocX files there is a commercial system called Docmosis that can popluate plain-text (or merge) fields and stream back populated PDF documents to your Python system, or deliver via email etc.
You would upload your "template" Doc files to Docmosis via the Website (or api calls) then invoke Docmosis using a https post from your Python code.
Please note I work for the company that created Docmosis.
Hope that helps.

Libraries for generating URL of uploading files in Django

Need to develop a project for file uploading and generating its(files's) URL, which could be shared. Are there any particular libraries or simple means in Python,(Django) that would be handy and efficient.?
~ Newbie trying a Herculean Task~ Thanks in Advance :)
Much of this is done for you in the Django-backed version of this excellent JQuery file upload app.
Try out a demo of the original here.
No. Since the Storage used may not even save the actual files on the filesystem, there is no universal way to generate a URL to them. You will need to create a view that gets passed a key that it can use to identify the record that has the file field, then you will need to respond with the file contents yourself.

Django reportlab - Print current page (admin console) to PDF

What I am trying to accomplish is to allow users to view information in the django admin console and allow them to save and print out a PDF of the information infront of them based upon how ever they sorted/filtered the data.
I have seen a lot of documentation on report lab but mostly for just drawing lines and what not. How can I simply output the admin results to a PDF? If that is even possible. I am open to other suggestions if report lab is not the ideal way to get this done.
Thanks in advance.
Better use some kind of html2pdf because you already have html there.
If html2pdf doesn't do what you need, you can do everything you want to do with ReportLab. Have a look at the ReportLab manual, in particular the parts on Platypus. This is a part of the ReportLab library that allows you to build PDFs out of objects representing page parts (paragraphs, tables, frames, layouts, etc.).

HTML page to PDF in Python?

Is there a library available to convert a HTML page (text, images, layout elements etc. ) to a PDF file.
I have an HTML page with figures, text and tables with numbers etc. which I want my clients to be able to download as PDF. How do I do this with Python?
Not too familiar with python, and prince is nice if you are willing to shell out the cash. There is this http://github.com/antialize/wkhtmltopdf that uses webkit. It is a simple command line utility that you can call and it will honor html+css. As far as I know, it is the only free tool to do so well. There is a ruby gem for it http://github.com/jdpace/PDFKit, not that it helps you but might give you some ideas.
Well, there are the reportlab and html2pdf modules, but for best results I'd probably try calling Prince externally (http://www.princexml.com/doc/6.0/python/) .
Have you heard of xhtml2pdf/pisa?
It has the ability to work as a python module or as a separate command line utility.
You can use the documentation here to get started:
http://www.xhtml2pdf.com/doc/pisa-en.html

Categories

Resources