Discussões
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
Renderizar PDF usando Suitelet e definir Nome do arquivo via SuiteScript
Aplica-se a
Produto: NetSuite 2020.1
Cenário
Renderizar uma string como PDF e definir o nome do arquivo quando baixado por Suitelet.
Solução
Implemente o seguinte código em um Suitelet:
function renderPDF(context){
var serverResponse = context.response; //Gets the response object
var testData = 'TEST BODY'; //Test string to be rendered as PDF
var filename = 'PurchaseOrder_123456.pdf'; //Sample File name to be set when downloaded
serverResponse.setHeader({
name: 'Content-disposition',
value: 'filename="' + filename + '"',
}); //sets the filename to the specified format or name
serverResponse.renderPdf({
xmlString: testData}); //renders the string as a PDF file
return;
}
Observações:
- Os cabeçalhos diferenciam maiúsculas de minúsculas
Rotulado:
0
Olá, bem-vind@!
Faça login
Para ver todos os detalhes, faça o login.
Cadastre-se
Não tem uma conta? Clique aqui para começar!