<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Davronbek</title>
    <description>The latest articles on Forem by Davronbek (@davronbek).</description>
    <link>https://forem.com/davronbek</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045339%2F459b18b4-6837-4560-bd81-c00edd4f8439.png</url>
      <title>Forem: Davronbek</title>
      <link>https://forem.com/davronbek</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/davronbek"/>
    <language>en</language>
    <item>
      <title>PHP/Laravel: &lt;embed&gt; cannot display 30MB+ PDF file</title>
      <dc:creator>Davronbek</dc:creator>
      <pubDate>Tue, 14 Mar 2023 20:36:12 +0000</pubDate>
      <link>https://forem.com/davronbek/phplaravel-cannot-display-30mb-pdf-file-5325</link>
      <guid>https://forem.com/davronbek/phplaravel-cannot-display-30mb-pdf-file-5325</guid>
      <description>&lt;p&gt;Hi folks!&lt;/p&gt;

&lt;p&gt;If I pass the direct url to the PDF file,  can display large PDF file, but if I generate preview url for that file, and in that preview page return the PDF file content,  cannot display it, showing error: &lt;/p&gt;

&lt;p&gt;Failed to load PDF document&lt;/p&gt;

&lt;p&gt;preview page (Laravel):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function preview(Request $request) {
  $pdfFileContent = $this-&amp;gt;storage-&amp;gt;getFileContent($request-&amp;gt;uuid);
  return response()-&amp;gt;make($pdfFileContent, 200, [
         'Content-Type' =&amp;gt; 'application/pdf',
         'Content-Disposition' =&amp;gt; 'inline',
  ])
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;view PDF:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;embed src="/file/preview/{uuid}" width="100%" height="800" type="application/pdf"&amp;gt;&amp;lt;/embed&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any help would be appreciated! Thanks beforehand!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>pdf</category>
      <category>displaylargepdffile</category>
    </item>
  </channel>
</rss>
