Changing the default output file name jasper_report.PDF when using Jasper report Connector

1
0
-1

I Create Jasper Report in Bonita 6.4.2 CE Can I change the default output file name jasper_report.PDF ? Can I set a specific output path? Thank in advance

Comments

Submitted by Sean McP on Thu, 06/04/2015 - 06:44

Where do you want to save the document?

Submitted by Sean McP on Thu, 06/04/2015 - 07:17

I think the only way to do what you want at the moment is to have a spare document in your process (tempDocHolder) (or create one using java/groovy) and copy the document saved from the jasper report connector to it and back, renaming it along the way.

You should open the jasper document as a byteArray and write it to the new documentValue giving it the new name...

See here for a possible starting point.

regards Seán

4 answers

1
+1
-1

Hello,
I found how it's possible to rename a jasper_report.pdf file.

Indeed, you have to modify the Document Filename.
In the same step I created my Jasper PDF, I added an output Operation on my pdf document with the code :

import org.bonitasoft.engine.bpm.document.Document;
import org.bonitasoft.engine.bpm.document.DocumentValue;

//New filename is set here
String **collaboratorName **= assignmentChangeBDM.getCollaboratorName().trim().replace(" ", "");
String **filename **= "MouvementPersonnel
" + collaboratorName + ".pdf";

//We're looking for the previously created document
long docId = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "pdf").getId();

Document doc = apiAccessor.getProcessAPI().getDocument(docId);

DocumentValue docValue = new DocumentValue(apiAccessor.getProcessAPI().getDocumentContent(doc.getContentStorageId()), doc.getContentMimeType(), filename);

return docValue;

1
0
-1

Hi, everyone.

The solution is this.
in output Operation on my pdf document with the code :

import org.bonitasoft.engine.bpm.document.DocumentValue;
String filename="FILENAME".pdf"
reportDocValue.setFileName(filename)

DocumentValue doc=reportDocValue;
return doc;

regards.

1
0
-1

Hello,

This method is not working for me, using 7.0.3.
The .pdf file I linked to my document is still 0kb after my process is finished, but the process has been correctly executed, and I still receive a jasper_report.pdf file by mail.

1
0
-1

Hi. You can change the document name and path in the Documents tab of your process. http://www.heberger-image.fr/data/images/52003_report.png

Comments

Submitted by Sean McP on Thu, 06/04/2015 - 06:43

This doesn't work, my understanding of the Documents attached to a process is the Starting point of a document-not the destination.

Choose From an external system if the document content is to be retrieved from an external system by URL

For further details see here and here.

regards Seán

Submitted by yannick.lombardi on Thu, 06/04/2015 - 09:00

I use version 6.3.7 and for me this work. In the jasper connector, you can choose the output operation and set the document : http://www.heberger-image.fr/data/images/50846_setdoc.png

Submitted by Sean McP on Thu, 06/04/2015 - 09:13

and from that it will save it to the C:\Users.... directory?

Cool, I never knew that. Thanks Yannick

regards

Submitted by romualdo.s.rs on Thu, 08/03/2017 - 18:59

Hello Yannick

So in the output operations of the jasper connector have you been able to set where the PDF is saved? Because I can only change the file name there

Notifications