Message Boards
How to add a file (pdf) to Liferay Portal using an OutputStream
Maria Z, modified 2 Years ago.
How to add a file (pdf) to Liferay Portal using an OutputStream
New Member Posts: 5 Join Date: 10/20/21 Recent PostsHi!
I would like to ask you if there is a way to upload a pdf to the Document Library using an OutStream.
My code is the next one:
//I have a variable (String) which contains the html of the pdf document
OutputStream out = resourceResponse.getPortletOutputStream();
HtmlConverter.convertToPdf(html, out);
//Now I want to add the pdf which is stored in the otuput stream to a folder
DLAppServiceUtil.addFileEntry(idRepository, idFolder, "title.pdf", "application/pdf","title.pdf", StringPool.BLANK, StringPool.BLANK, ????, html.length, serviceContext);
How can I upload the file in the "????" field?
Thank you very much in advance
Olaf Kock, modified 2 Years ago.
RE: How to add a file (pdf) to Liferay Portal using an OutputStream
Liferay Legend Posts: 6396 Join Date: 9/23/08 Recent PostsI'm pretty sure I've answered this question very recently. Did you crosspost it somewhere else? Or did I miss hitting the "submit" button?
Maria Z, modified 2 Years ago.
RE: RE: How to add a file (pdf) to Liferay Portal using an OutputStream
New Member Posts: 5 Join Date: 10/20/21 Recent PostsI don't know hahah. But I have fixed it creating an input file from an output file. Thank you!!