Is there a way to use the renderer to load a PDF f...
# suitescript
y
Is there a way to use the renderer to load a PDF from a URL, and display that? I already have the binary, and can save it as a PDF in the file cabinet if I really wanted to, but would prefer to try and avoid saving it to the cabinet at all if I could, and rather just grab it straight from the URL and display that. I've already tried to render it, but I can't see a clear way to render a binary, all the examples appear to be just XML -> PDF
Copy code
var response = https.request({
            method: https.Method.GET,
            url:
              'www.someurl.php?getPdf',
            body: '',
            headers: headerObj
          });
          log.debug({
            title: 'PDF',
            details: response
          }); // this is the PDF binary
          context.response.addHeader({
            name: 'Context-Type',
            value: 'application/pdf'
          });
          context.response.addHeader({
            name: 'Context-Disposition',
            value: 'inline; filename=mypdf.pdf'
          });
          context.response.writePage(response);
b
use ServerResponse.writeFile to write the file instead of saving it in the file cabinet
1
y
@battk thank you!!!!!!!