<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>How to add a file (pdf) to Liferay Portal using an OutputStream</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121208051" />
  <subtitle>How to add a file (pdf) to Liferay Portal using an OutputStream</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121208051</id>
  <updated>2026-04-04T01:10:01Z</updated>
  <dc:date>2026-04-04T01:10:01Z</dc:date>
  <entry>
    <title>RE: RE: How to add a file (pdf) to Liferay Portal using an OutputStream</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121229617" />
    <author>
      <name>Maria Z</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121229617</id>
    <updated>2021-11-03T11:31:58Z</updated>
    <published>2021-11-03T11:31:57Z</published>
    <summary type="html">&lt;p&gt;I don't know hahah. But I have fixed it creating an input file from
  an output file. Thank you!!&lt;/p&gt;</summary>
    <dc:creator>Maria Z</dc:creator>
    <dc:date>2021-11-03T11:31:57Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to add a file (pdf) to Liferay Portal using an OutputStream</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121216847" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121216847</id>
    <updated>2021-10-25T08:03:41Z</updated>
    <published>2021-10-25T08:02:26Z</published>
    <summary type="html">&lt;p&gt;I'm pretty sure I've answered this question very recently. Did you
  crosspost it somewhere else? Or did I miss hitting the
  &amp;quot;submit&amp;quot; button?&lt;/p&gt;</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2021-10-25T08:02:26Z</dc:date>
  </entry>
  <entry>
    <title>How to add a file (pdf) to Liferay Portal using an OutputStream</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121208050" />
    <author>
      <name>Maria Z</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121208050</id>
    <updated>2021-10-20T16:51:32Z</updated>
    <published>2021-10-20T11:24:24Z</published>
    <summary type="html">&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;I would like to ask you if there is a way to upload a pdf to the
  Document Library using an OutStream.&lt;/p&gt;
&lt;p&gt;My code is the next one:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;//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, &amp;quot;title.pdf&amp;quot;, &amp;quot;application/pdf&amp;quot;,&amp;quot;title.pdf&amp;quot;, StringPool.BLANK, StringPool.BLANK, ????, html.length, serviceContext);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How can I upload the file in the &amp;quot;????&amp;quot; field?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thank you very much in advance&lt;/p&gt;</summary>
    <dc:creator>Maria Z</dc:creator>
    <dc:date>2021-10-20T11:24:24Z</dc:date>
  </entry>
</feed>
