Hemant
Hemant

Reputation: 1343

Need help to generate report in PDF or Doc using python

I want some help to generate a report in PDF/Doc(MS Word) format . I’m not able to find any module to generated report in doc, except “docx” which I’m not able to comprehend. Actually I’m actual task is to generate the report in Doc only, but as I’m not able to find a module to work on it, I opt for PDF. I’m using “Report Lab” module, but I’m finding some limitation in that. It write anything based on co-ordinate system. The problem I’m facing with that the report is usually a string, whose length is not limited, so sometime it goes beyond the canvas( Pdf Page). Also there is not functionality I guess to do format font with Bold, Italics and Underline.

If you know any module to generate report in PDF or Doc, please let me know. My requirement is:

  1. Able to add an image at an header.
  2. Change fonts and other properties, like Bold, Italics, and Underline
  3. Able to draw basic shape like line
  4. Write string, as a statement, as we are able to do with able to write into txt file using python(not on co-ordinate system basis)

Upvotes: 2

Views: 2187

Answers (3)

Juri Robl
Juri Robl

Reputation: 5736

You could also try and generate LaTeX Code, which you then compile to PDF.

Upvotes: 1

Gordon Seidoh Worley
Gordon Seidoh Worley

Reputation: 8068

I should point out you can do all the stuff you want in ReportLab by using the supporting PLATYPUS module. It lets you easily build documents out of objects in code. Alternatively, there is RML, a ReportLab way of building documents from an HTML-like markup language.

Upvotes: 1

Burhan Khalid
Burhan Khalid

Reputation: 174614

If you can express your document (including formatting and layout) using HTML, then use xhtml2pdf. As the name suggests, it will take some HTML document and convert it to PDF preserving the layout and most other design elements.

If you still want to create a doc file, this question has some excellent suggestions.

Upvotes: 3

Related Questions