suitelet to open pdf without saving it from xml fi...
# ask-stanley-ai
k
suitelet to open pdf without saving it from xml file
c
AI generated answer (using internal Slack threads):
To render an XML string as a PDF in a new tab using a Suitelet, you can use the
window.open
method to open a new tab to the Suitelet, and then make the Suitelet write your file in response to the
window.open
. However, please note that the
window.open
method works from the client-side. Here is a code snippet that you can use:
Copy code
javascript
context.response.writeFile({
    file: yourFile,
    isInline: true
});
In this code,
context.response.writeFile
is used to write the file to the response. The
isInline
option is set to
true
, which means the file will be displayed in the browser rather than being downloaded. Please note that the
render
module is not supported for Client Script (CS), it is only for User Event (UE). If you are facing issues with the file not being downloaded as a PDF but as a scriptlet file, you might want to check the headers in your PDF Template. They should start with something like:
Copy code
xml
<?xml version="1.0"?>
<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>
Also, it could be due to settings in your browser (e.g., extensions, cache) or security software. Trying a different browser might help. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832946837
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826599181
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825378537
Please provide your feedback on this answer.