cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create a .pdf file in perticular folder

chamithmalinda
Champ in-the-making
Champ in-the-making
Hi all,

I want to create a .pdf file using the action class(JAVA) in alfresco repository folder according to the parameters passed from the parallel-review-group.bpmn20.xml

How can i pass the node(for the particular folder) from this xml to the action class to create the .pdf file using following command

pdfInfo = fileFolderService.create(node,"ResponseDOC.pdf", contentQName);

My problem is how to create or get the value of node object.

please help me in this.

thanks,
Chamith.
2 REPLIES 2

chamithmalinda
Champ in-the-making
Champ in-the-making
I'm having the following error when proceed with my code.

org.alfresco.service.cmr.model.FileExistsException: Existing file or folder ResponseDOC.pdf already exists


is there any one help me to resolve this problem . . . . .  Smiley Indifferent  :cry:

srikanth94
Confirmed Champ
Confirmed Champ

Hi ,

It seems like already a file exits with same name, to create a pdf file hope this snippet helps you

    // Create new nodes    
FileInfo fileInfoPdf = this.fileFolderService.create(parentNoderef, "test_doc.pdf", ContentModel.TYPE_CONTENT);
this.pdfNode = fileInfoPdf.getNodeRef();
ContentWriter contentWriter = this.contentService.getWriter(fileInfoPdf.getNodeRef(), ContentModel.PROP_CONTENT, true);
contentWriter
.setEncoding("UTF-8");
contentWriter
.setMimetype(MimetypeMap.MIMETYPE_PDF);
contentWriter
.putContent(pdfStream);