Discusiones

Ahora es el momento de pedir a sus amigos y colegas expertos en NetSuite que se unan a la comunidad de soporte de NetSuite. ¡Recomiende ahora! ¡Haga clic aquí por más información!
Actualice su Perfil con su tipo de soporte para obtener la insignia de Tipo de Soporte.
Nominate Your Peers for NetSuite Support Community's Choice of the Quarter! Submit your nomination today.
Intelligent Payment Automation version 1.0.3 is now available in the SuiteApp Marketplace. The SuiteApp, powered by BILL, lets you automate payments, manage vendor details, and bank account information within NetSuite. Learn more

Renderice PDF con Suitelet y establezca el nombre del archivo a través de SuiteScript

editado Jun 2, 2025 2:32PM en SuiteCloud / Personalización

Se aplica a

Producto: 2020.1


Escenario

Renderice una cadena como PDF y establezca el nombre del archivo cuando lo descargue a través de Suitelet


Solución

Implemente el siguiente código en un 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;
 }



Notas:

  • Los encabezados distinguen entre mayúsculas y minúsculas

¡Hola, Bienvenido/a!

Iniciar sesión

Para ver los detalles completos, inicia sesión.

Registrarse

¿No tienes una cuenta? ¡Haz clic aquí para comenzar!

Tabla de posiciones

Genio de la Comunidad

Cuarto 4 (Oct-Dec 2025)

Líderes de la semana

Líderes de este mes

Líderes de todos los tiempos