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

How to send a PDF to JasperSoft Server?


abusch100

Recommended Posts

Is there a way to send a PDF back to the Server created with a template that comes from a JasperSoft Server? I have a Template on my JasperServer running on Docker. I can display and create my desired PDF on my App and the Template works. Now I want to save that Report that I create back to the server to a special Folder. Is it possible to tell Jasper to save the Report on for Example Report Execution? Maybe with some params or something? 

 

The Code - creating the PDF from Template: 

    await fetch(      "http://docker03.xxx.lan/jasperserver/rest_v2/reportExecutions",      {        method: "POST",        headers: {          Accept: "application/xml",          "Content-Type": "application/xml",        },        body: `            <reportExecutionRequest>            <reportUnitUri>/xxx/xxx</reportUnitUri>            <async>false</async>            <freshData>true</freshData>            <saveDataSnapshot>false</saveDataSnapshot>            <outputFormat>html</outputFormat>            <interactive>false</interactive>              <parameters>[/code]

Report Execution: 

    await fetch(      `http://docker03.xxx.xxx/jasperserver/rest_v2/reportExecutions/${this.state.requestID}/exports/${this.state.exportID}/outputResource`,      {        method: "GET",      }    )[/code]

So either in one of those 2 calls OR something I also found but I cant get to work: 

      fetch(      "http://docker03.xxx.xxx/jasperserver/rest_v2/resources/Name_Folder",      {        method: "POST",        headers: {          'Content-Type': 'application/pdf'        },        body: MyPDFfromFolderStructure  })[/code]

When I try this by taking a PDF right from my Folder Structure I get ERROR: Network request failed  

 

Also in generall: Are there any tutorials or "good" Docs for this? All I can see is some basics but no real examples on how to do it via REST. Also the tutorials I've seen from Jasper are bad and cover basics mostly for JasperStudio only. 

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

You can use the "jobs service" to trigger an immediate execution of the report and send the pdf to the server at a specific location.

https://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v8/jobs-service#Creating_a_Job

You may also upload the file to the location using the resource service.

https://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v8/resources-service#Creating_a_Resource

Link to comment
Share on other sites

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...