Jump to content
We've recently updated our Privacy Statement, available here ×

Jasperserver Rest API blank PDFs (using Python)


assiacpge2011

Recommended Posts

with Python and Jasperserver REST API I'm sending http requests to generate a PDF Report but I get blank PDFs. I'v looked for a solution over the net but couldn't solve the problem. I don't know if it's a problem with jasperserver or with my Script or with encoding.


When I try to export the report in HTML format I get it with no problem...but my aim is to have PDF reports not HTML ones.


my PDF export is fine on Ireport and Jasperserver...but not with my Python Script.


My report is containing charts,tables and colors ..and I'm using SanSerif font.


Below is the last part of my Script and there is the last http request that generates the PDF report:


p=s.get('http://host:port/jasperserver/rest/report/*theUUID?  file=report&RUN_OUTPUT_FORMAT=PDF',stream=True)

c = canvas.Canvas('fileName.pdf')

c.save()

des=open('fileName.pdf','w')

des.write(p.text.encode('utf-8', 'replace'))

des.close()

 

the Result is a blank PDF 'fileName.pdf' that has 3 pages (when I run the same report on Ireport or Jasperserver I get 3 pages but not blank)


I'm using Requests for http requests and Reportlab to create the PDF file


Please I need Help.



 

Link to comment
Share on other sites

  • 3 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...