Answers.Body: <p><strong>UPDATE 2/Resolution</strong></p>
  
  <p>I don't really have an explanation for what was happening. Hopefully this will help others if they experience the same. I'm happy to update the answer however if anyone has suggestions.</p>
  
  <p>I am forcing <code>https</code> on my site via <code>.htaccess</code>. </p>
  
  <p>The pdf would render 100% of the time in every browser when the request was made using <code>http</code>. When the pdf was requested using <code>https</code> In Chrome I would always get "Failed to load PDF document". Firefox would always work and Safari would give me a grey screen. For others, it would work sporadically. </p>
  
  <p>All of my images are being served from an S3 source (all https) so all of my assets were secure.</p>
  
  <p>I ended up making my <code>.htaccess</code> file force https for everything <em>except</em> the request to the pdf.</p>
  
  <pre><code>RewriteCond %{HTTP:X-Forwarded-Proto} !^https
  RewriteCond %{QUERY_STRING} !(^|&amp;)entryId=(.*?)(&amp;|$) [NC]
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
  
  RewriteCond %{HTTP:X-Forwarded-Proto} ^https
  RewriteCond %{QUERY_STRING} entryId=(.*?)(&amp;|$) [NC]
  RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L] 
  </code></pre>
  
  <p>The url to my pdf looks like this:</p>
  
  <pre><code>https://mysite.com/entry/pdf?entryId=123
  </code></pre>
  
  <p>When a user makes a request to that url, they are redirected (301) to a non-https version.</p>
  
  <pre><code>http://mysite.com/entry/pdf?entryId=123
  </code></pre>
  
  <p>Hope this helps someone else!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-28T15:20:04.177Z
Answers.LastActivityDate: 2017-06-28T15:20:04.177Z
Answers.UserDisplayName: Damon
Answers.Body: <p>Check your urls in your admin panel - e.g. the site url under the "General" panel, and then also anything under Assets. Is that set to be https? Or just http? </p>
  
  <p>If, for example, your asset folder is set to be <em>http</em>://www.mysite.com/images/ and you load <em>https</em>://www.mysite.com/page.html - images on that page will try to load from <em>http</em>://www.mysite.com/image.jpg</p>
  
  <p>edit: Chrome will block http items from loading on an https page, and firefox will not. (at least by default)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-23T15:00:16.413Z
Answers.Text: Hi SamC - all of the assets are coming from an S3 prefix. I've made sure to set all of the S3 url's to include `https`. I did not have the site settings to include https. I tried but got the same result. "Failed to load PDF". Odly enough, Firefox works...
Answers.UserDisplayName: Damon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-23T19:01:47.923Z
Answers.Text: Ah. I haven't used S3 much via SSL - Can you get images to load on an https page from that S3 bucket?
Answers.UserDisplayName: SamC
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-23T19:26:33.317Z
Answers.Text: Yep! Everything works great otherwise - Firefox even renders the PDF.
Answers.UserDisplayName: Damon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-23T19:57:36.710Z
Answers.Text: Well, firefox will display mixed http & https content with an error over the lock. Whereas chrome won't load the non-https stuff at all. I was suggesting that if chrome won't show an image from S3, it's an http/https setting. If chrome *does* show an image from the S3, it's something more specific to chrome. that make more sense?
Answers.UserDisplayName: SamC
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-23T21:53:30.857Z
Answers.Text: Yep! makes sense to me. Turns out its the actual image(s) that are causing the problem.
Answers.UserDisplayName: Damon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-26T15:47:21.797Z
Answers.Text: Was working on a PDF thing this morning, and debugging a similar issue in chrome. It doesn't like relative links for images. "/images/myimage.png" gave the 'image not found error' - making it an absolute url "https://www.mysite.com/images/myimage.png" worked.
Answers.UserDisplayName: SamC
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-26T18:52:27.757Z
Answers.Text: I am pulling from an S3 prefix, so each image is using a fully qualified url (also https). Everything works great when the site is http. Even pulling https images into http works great. 
  
  As soon as I force https, the wheels come off. Forcing http on that specific url may be my only option. Just gotta figure out how to do that. :)
Answers.UserDisplayName: Damon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-23T14:13:47.083Z
Answers.LastActivityDate: 2017-06-23T18:54:03.680Z
Answers.LastEditDate: 2017-06-23T18:54:03.680Z
Answers.UserDisplayName: SamC
Body: <p>I am using the <a href="https://straightupcraft.com/craft-plugins/printmaker" rel="nofollow noreferrer">Printmaker</a> plugin to print a pdf. Everything seems to be working well when the site is not being forced to use SSL.</p>
  
  <p>I am getting the message "Failed to load PDF document."</p>
  
  <p>If I remove the SSL, the pdf renders correctly. I would really like to have my site be under https - is there any way to help printmaker work?</p>
  
  <p>I don't see anything obvious in the <code>craft.log</code> that would indicate an error, is there a configuration setting I'm missing?</p>
  
  <p>Thank you for any suggestions!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>It is the actual image(s) in the pdf that are causing the error.</p>
  
  <p>The full path to the S3 bucket is https, and I'm able to access the image just straight through the browser. I've copied/paste into the url bar and the image will render.</p>
  
  <ul>
  <li>If I set the S3 path to http, and set the browser to http - all is well. </li>
  <li>If I set the S3 path to https, and the browser to http - all is well.</li>
  <li>If I set the S3 path to https and the browser to https - pdf fails to render.</li>
  </ul>
  
  <p><strong>UPDATE</strong></p>
  
  <p>To further test and and attempt to get some kind of error message/log to help trouble shoot, I've moved my image directory to a local path. I now the error "Image not found or type unknown". It looks like this could be a <a href="https://github.com/dompdf/dompdf/issues/1118" rel="nofollow noreferrer">DOMPDF issue</a>. I will continue to update this thread as I uncover more.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>It <em>does</em> seem to be something related to forcing requests to SSL. If I remove https, the pdf renders every single time, every browser. If the request is made to the pdf using https, it fails every time.</p>
  
Tags: <htaccess><plugin-printmaker>
Title: Printmaker fails to render images under SSL
ThreadText: # Printmaker fails to render images under SSL
  
  (Asked by: username_0 on 2017-06-23)
  
  I am using the [Printmaker](https://straightupcraft.com/craft-plugins/printmaker) plugin to print a pdf. Everything seems to be working well when the site is not being forced to use SSL.
  
  I am getting the message "Failed to load PDF document."
  
  If I remove the SSL, the pdf renders correctly. I would really like to have my site be under https - is there any way to help printmaker work?
  
  I don't see anything obvious in the `craft.log` that would indicate an error, is there a configuration setting I'm missing?
  
  Thank you for any suggestions!
  
  **EDIT**
  
  It is the actual image(s) in the pdf that are causing the error.
  
  The full path to the S3 bucket is https, and I'm able to access the image just straight through the browser. I've copied/paste into the url bar and the image will render.
  
  * If I set the S3 path to http, and set the browser to http - all is well.
  * If I set the S3 path to https, and the browser to http - all is well.
  * If I set the S3 path to https and the browser to https - pdf fails to render.
  
  **UPDATE**
  
  To further test and and attempt to get some kind of error message/log to help trouble shoot, I've moved my image directory to a local path. I now the error "Image not found or type unknown". It looks like this could be a [DOMPDF issue](https://github.com/dompdf/dompdf/issues/1118). I will continue to update this thread as I uncover more.
  
  **UPDATE**
  
  It *does* seem to be something related to forcing requests to SSL. If I remove https, the pdf renders every single time, every browser. If the request is made to the pdf using https, it fails every time.
  
  **Tags:** htaccess, plugin-printmaker
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2017-06-28. Score: 3 | Accepted answer
  
  **UPDATE 2/Resolution**
  
  I don't really have an explanation for what was happening. Hopefully this will help others if they experience the same. I'm happy to update the answer however if anyone has suggestions.
  
  I am forcing `https` on my site via `.htaccess`.
  
  The pdf would render 100% of the time in every browser when the request was made using `http`. When the pdf was requested using `https` In Chrome I would always get "Failed to load PDF document". Firefox would always work and Safari would give me a grey screen. For others, it would work sporadically.
  
  All of my images are being served from an S3 source (all https) so all of my assets were secure.
  
  I ended up making my `.htaccess` file force https for everything *except* the request to the pdf.
  
  ```
  RewriteCond %{HTTP:X-Forwarded-Proto} !^https
  RewriteCond %{QUERY_STRING} !(^|&)entryId=(.*?)(&|$) [NC]
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
  
  RewriteCond %{HTTP:X-Forwarded-Proto} ^https
  RewriteCond %{QUERY_STRING} entryId=(.*?)(&|$) [NC]
  RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L] 
  
  ```
  
  The url to my pdf looks like this:
  
  ```
  https://mysite.com/entry/pdf?entryId=123
  
  ```
  
  When a user makes a request to that url, they are redirected (301) to a non-https version.
  
  ```
  http://mysite.com/entry/pdf?entryId=123
  
  ```
  
  Hope this helps someone else!
  
  
  ---
  
  ### Answer by username_1 on 2017-06-23. Score: 1
  
  Check your urls in your admin panel - e.g. the site url under the "General" panel, and then also anything under Assets. Is that set to be https? Or just http?
  
  If, for example, your asset folder is set to be *http*://www.mysite.com/images/ and you load *https*://www.mysite.com/page.html - images on that page will try to load from *http*://www.mysite.com/image.jpg
  
  edit: Chrome will block http items from loading on an https page, and firefox will not. (at least by default)
  
  > **Comments:**
  > **username_0**: Hi username_1 - all of the assets are coming from an S3 prefix. I've made sure to set all of the S3 url's to include `https`. I did not have the site settings to include https. I tried but got the same result. "Failed to load PDF". Odly enough, Firefox works...  
  > **username_1**: Ah. I haven't used S3 much via SSL - Can you get images to load on an https page from that S3 bucket?  
  > **username_0**: Yep! Everything works great otherwise - Firefox even renders the PDF.  
  > **username_1**: Well, firefox will display mixed http & https content with an error over the lock. Whereas chrome won't load the non-https stuff at all. I was suggesting that if chrome won't show an image from S3, it's an http/https setting. If chrome *does* show an image from the S3, it's something more specific to chrome. that make more sense?  
  > **username_0**: Yep! makes sense to me. Turns out its the actual image(s) that are causing the problem.  
  > **username_1**: Was working on a PDF thing this morning, and debugging a similar issue in chrome. It doesn't like relative links for images. "/images/myimage.png" gave the 'image not found error' - making it an absolute url "https://www.mysite.com/images/myimage.png" worked.  
  > **username_0**: I am pulling from an S3 prefix, so each image is using a fully qualified url (also https). Everything works great when the site is http. Even pulling https images into http works great.   As soon as I force https, the wheels come off. Forcing http on that specific url may be my only option. Just gotta figure out how to do that. :)  
  
  ---
  
  