Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm working in a project to analyze and create PDF file.
I almost done with analysis part but I reached the part of creation pdf files.
is there any library or tool in Python I could use to create pdf and also to emmbed actctions within it?
There are several libraries that can create PDF files for different purposes. A couple of examples.
The matplotlib library can generate plots in PDF format.
The Python binding to the cairo graphics library, pycairo. Very good for drawing, but less suited for typesetting.
Reportlab, written in pure Python.
Not really a library, but definitely an option;
For high-quality typesetting, you can use Python to generate (La)TeX source code, which can be converted into PDF with pdftex. This requires that you have a TeX distribution installed though.
One way to embad actions in PDF files is to use javascript. E.g. this TUGboat article describes how to include javascript in PDF files generated with LaTeX.
Note however that not all PDF viewers support this.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 15 days ago.
The community reviewed whether to reopen this question 15 days ago and left it closed:
Original close reason(s) were not resolved
Improve this question
What are good Python-based options to create strictly designed PDF reports from HTML?
I've attached a draft PDF to illustrate the following points:
The design of the report is rather strictly designed. In other words "Looks matter".
The report contains complex vector graphics (package: Matplotlib).These may slightly differ in size .
The report contains images.
The report contains a large number of numbers / strings filled in dynamically.
Optimally, the solution would use open source packages.
We create our HTML with Django.
The report may span multiple pages.
It looks as if there was already a good amount of very diverse packages facilitating reporting. Just to name a few, there are xhtml2pdf, weasyprint, django-wkhtmltopdf.
In my experience, it’s easy with these tools to create a PDF from your content. The hard part comes when the PDF needs to fall into a highly-defined design structure as in our case. Unfortunately, I was not able to find example PDFs for the different PDF generation packages that have a highly designed structure.
What is your experience with this? Which options worked well for you? Are there well done complex examples that I’ve overlooked?
You can see this Python package: weasyprint
Web page: http://weasyprint.org/
Official doc: http://weasyprint.readthedocs.io/en/latest/
It's great, because you can generate the PDF from a web page or an html file, you can have conflicts with some CSS (which are specified in the documentation), but it provides what you need
I recently used weasyprint and jinja to do automated report generation from html. It worked well and I believe would be capable of meeting your strict format requirements. I haven't used any of the others though.
My report had images, including graphs converted to images, normal dynamically generated text, as well as large tables. All of this was constrained to an 9x11 page size. Weasyprint does a good job of pagination automatically, but also has configurability in that regard.
I found this guide to be very useful:
http://pbpython.com/pdf-reports.html
Although I think pandas is total overkill for html generation of graphs and you lose a lot of configurability using it.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm looking for a Python library that will allow me to record, manipulate, and merge audio files. Most of the ones I've seen don't support Windows and/or are outdated. Does anyone have any suggestions for libraries or how these functions could be implemented with the standard python library?
Recording and Manipulating are generally different problems. For both of these, I stick with .wav file formats since (at least in their simpler forms) they are basically just the raw data with a minimal header and are easy to work with.
Recording: I use pyaudio, which provides bindings to the portaudio library.
Manipulation: For simple things I use audioop which is included in the basics Python installation, and for more complex things I go straight to scipy (which can read in many .wav files with scipy.io.wavfile.read) and then manipulate the data like any other time-series data. scipy is powerful and fast, but doesn't offer many audio specific tools nor does it present things in an audio specific terminology.
There are other things out there, though less well established, such as Snack, Audiere, and AudioLazy, are tools I've heard of bet never used, and I don't know which are still available, or their level of development, etc.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Blender has a powerful, fun-to-use, flexible node editor:
Is there a Python library that will allow me to easily create a visual developing environment like this? In Blender, the node editor works with shaders, images, colors and the like, and I'd like to define the types of nodes, sockets and preview widgets myself, as in building a "visual DSL".
Edit: I don't want to create custom nodes within Blender, but use a component LIKE the node editor in my own projects. I removed the Blender tag to avoid confusion.
You can find how to do that in the documentation:
http://wiki.blender.org/index.php/User:Phonybone/Python_Nodes
If you want to use the nodes to build objects and meshes procedurally with it then I recommend you to use and/or fork and and improve this project:
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Nodes/Sverchok
(These guys are also using the API linked above)
If you have blender specific questions, like this, I also recommend you to ask it on this blender dedicated stack exchange site:
https://blender.stackexchange.com/
EDIT:
As far as I know, there isn't any pre-made node-editor widget or anything similar like that in any UI libraries. However it is quite easy to implement the basic rectangles , input and output ports and the bezier lines to connect them. After the first steps it is only a matter of preference how many hours you put into design and smaller details.
I implemented my own in Python with the builtin tkinter library:
And then later in Pyglet and after that to improve speed I implemented it in pure C with OpenGL wrapped with Cython for Python usage:
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have a simple project in mind that would take a long list of triplets as input (coordinates describing a path in 3 dimensions), and generates an STL file as output. (STL is a file format that describes 3-D surface geometry for use in CAD and 3-D printing applications.)
I'm a scientist, not a developer, and I'm capable with Python, so I can handle parsing an input text file if needed. What I am looking for is a command line utility, library, or simple programming language that can automate a few simple CAD tasks (e.g. extrude a cross section along a path) to create a true 3-D surface for STL output.
Thanks.
Have you considered using Blender?
It has a Python API, and can also be used in headless mode (without a GUI) by using blender --python script.py.
It also has an STL import/export plugin (make sure to enable it in Preferences -> Addons if you decide to try it). I'd also suggest to look at its source code if you decide to roll your own.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am building a python script to run nightly, part of which involves invoking a drupal bulk operation to export an XML file. Since the process takes a number of hours, and the next step is to automatically import it to another source, I would like to perform some level of integrity checking.
My first thought would be to simply make sure that the XML is not malformed. I don't particularly want to start inspecting the data, I just want to make sure it's not truncated.
What process might I use to perform this malformed check. Is there an applicable XML library built into Python? I would prefer to keep the script as portable as possible, so if possible a built-in solution would be the most preferable.
Thanks for any advice.
If you want use python, you can consider using element tree
Load your .xml and try to parse. Any Exception means XML is malformed.