Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to add a file (pdf) to Liferay Portal using an OutputStream
Hi!
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
I'm pretty sure I've answered this question very recently. Did you crosspost it somewhere else? Or did I miss hitting the "submit" button?
I don't know hahah. But I have fixed it creating an input file from an output file. Thank you!!
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™