0

Hopefully a simple question - I am trying to open a PDF from my app into a child window using the following code:

   REST.getOne(url, orgId, pdfUrl => { //this is a simple AJAX get request
      report.pdf = window.open('', 'report_pdf');
      report.pdf.location.href = pdfUrl;
   });

or

   REST.getOne(url, orgId, pdfUrl => { //this is a simple AJAX get request
      report.pdf = window.open(pdfUrl, 'report_pdf');
   });

The new window opens but the page is blank.

If I copy the URL to a new tab manually, the PDF loads as expected.

This is an example of the URL I am trying to open in the new window: https://dev-plenty-file-bucket.s3.amazonaws.com/03d2070e-c159-4b9d-93d7-b395b6b3c7df.pdf?response-content-type=application%2Fpdf&X-Amz-Security-Token=IQoJb3JpZ2luX.....FmapjRJRJEsEVHgEc0Y8qKl1i5pNH1Jpq1ltNCA6YRNsfPGinSXHfJr4.....i4b%2B2vw%....%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=2020...042Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=ASIA.....625%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=a0b1....98e8

Any ideas?

Thanks

user2115620
  • 101
  • 1
  • 10

1 Answers1

0

Fixed by using the object embed method described in this post: Display PDF within web browser

<object data='http://website.com/nameoffolder/documentname.pdf#toolbar=1' 
  type='application/pdf' 
  width='100%' 
  height='700px'>
user2115620
  • 101
  • 1
  • 10