Create a downloadable pdf of pytest report in python - pdf

I need a report generated after pytest test is executed.I used allure report and pytest html report also but I am unable to get pdf as they are only providing me the html format even though their report presentation is remarkable. Is there any substitute for that so that I could get the same but in pdf format just as in Java we can get report in pdf

I'm currently working on something quite similar to this question.
This answer provides a helpful way to access test results while running pytest.
My technique is to get the results organized in a dict and then generate a markdown file I feed to pandoc through subprocess.
Update: this technique works fantastically.

Related

How do I create a PDF directly from code?

Is there an IDE (that preferably uses C), that allows me to output the results of a program onto a PDF?
I am tasked with writing a program that does a specific set of computations in which the results of each individual computation needs to be output onto a PDF file that can be opened later normally. Is there an IDE that would allow me to do such a thing? I'm currently using Codeblocks and I'm not sure whether it can do what I need as I'm not too familiar with it.
If your question is simply how to printout your code as a PDF most if not all IDEs can do that via printing.
If its how to hand write a pdf with an ID Editor you need to learn how to hand code a pdf first.
However for code::blocks see 2.14 Source Code Exporter in the PDF User Manual

I would like to convert PDF to Post Script

I would like to convert PDF to Post Script or else is there any possible to generate post script from RDLC report in C#.net
How can I achieve this?
Ghostscript and Poppler can both take PDF as input and produce PostScript, I suspect other libraries can do so as well. Have you tried Google ?

Creating math formulas in convert PDF files (where input is website)

I am using MathJax in my website to create math formulas and it's working great.
I need a way to output those formulas into PDF documents generated by my server.
I'm currently using a Windows server and backend is PHP.
I'm using TCPDF to create my PDF files, but I cant find any way to get my math formulas into those PDFs, be cause the math formulas are stored in my database in TeX format.
Is there anyway to convert them to math formulas before I insert them into my document?
At first I tried to use the SVG output format from MathJax and somehow extract that output, save it in my database and use that with TCPDF, but apparently it is not good enough because the SVG output from MathJax isn't only SVG.
I have looked for online tools to convert my TeX formulas into images, but I didn't find any site that provides an API for that. So I looked for a command line tool, but it seems like most (or all of them) are for Linux systems only.
I tried this one, tex2png,
but it didnt work :
BTW, I don't have Latex installed. Do I need to install in order to use tex2png?

Is there a way to test PDF outputs in acceptance / e2e tests?

In order to test the results of most of my business requirements I need to find out if a PDF is rendered correctly.
A typical test involves a few UI interactions with an Web application and the download of the resulting PDF.
Then the results should be compared to their expectations.
Is there a testing framework capable of examining a PDF?
There are already lots and lots answers on StackOverflow dealing with similar questions.
Look at this list:

How to unit test a Python function that draws PDF graphics? (StackOverflow)
Visual diff PDF files in order to determine pixel perfectness (StackOverflow)
How to compare two PDF files through command line (StackOverflow)
Comparison of two PDF files (StackOverflow)
PDF compare on Linux command line (StackOverflow)

Generate PDF from structured data

I want to be able to generate a highly graphical (with lots of text content as well) PDF file from data that I might have in a database or xml or any other structured form.
Currently our graphic designer creates these PDF files in Photoshop manually after getting the content as a MS Word Document. But usually, there are more than 20 revisions of the content; small changes here and there, spelling corrections, etc.
The 2 disadvantages are:
1) The graphic designer's time is unnecessarily occupied. The first version is the only one he/she should have to work on.
2) The PDF file becomes the document which now has the final revised content, and the initial content is out of sync with it. So if the initial content needs to be somewhere else (like on a website), we need to recreate it from the PDF file.
Generating the PDF file will help me solve both these problems. Perhaps some way in which the graphic designer creates a "Template" and then puts in tags/holders and maps these tags/holders to the relevant data.
Thanks :-)
There are some tools out there for doing this. XSL-FO is useful. Here is a tutorial for creating a pdf from xml (or xhtml) with cocoon. Also see Apache FOP.
You could format your SQL data as XML and still use the same templates this way.
I use the ReportLab python library for this. It could perhaps solve your problem, but you will need to do some work...
In the past I have written scripts that spit out LaTeX then used texi2pdf to solve this kind of problem.
Take a look at iReport and JasperReports at http://jasperforge.org.
iReport lets you design reports, and then you can either programatically fill it with the JasperReports library (Java), or just use iReport to manually create the report.
I have only used it for tabular data, but I don't think there would be any problem for other types of documents.
You could create a form and populate the entries programmatically using a pdf library like iText (Java).
You could look at doing the workflow in PostScript which is plain text that you can easily compose from fragments. Then you can use any free tool to convert to PDF.
Take a look at Prince XML. This tool allows to generate PDF based on XML or HTML and CSS.
A possible way is to use a template engine, like FreeMarker or StringTemplate: these are often used to generate HTML, but they are flexible enough to output any format, actually.
The problem is to make a PDF template, I suppose. Perhaps you can take a sample output and edit it to replace data with placeholders to be filled by the template engine. Might not be trivial!
Sounds like a job that SQL Server Reporting Services can handle quite easily.
Reporting Services allows you to query the data, define the layout, and export to PDF without any intervention. The PDF output can be distributed via email, stored on a file share, and accessed via a page on the report server.
It can handle XML data sources too.
Another approach to generating a PDF file from data is to use prawn, which is based on ruby. I was very pleasantly surprised by how much functionality is included in prawn. It may take some investment up front but this approach will give you a lot of flexibility.
You can combine CSStoXSLFO with XEP from RenderX for high quality output. With this solution you can merge XML data into an XHTML template, which is decorated with CSS. It can also generate charts with the fantastic JFreeChart library. CSS3 page media features are supported.