Vedachalam Mahadevan
03/17/2025, 5:43 AMCeligo AI
03/17/2025, 5:47 AMAI generated answer (using internal Slack threads):Based on the conversations provided, it seems that the user was trying to use an external library (jsPDF) to generate PDFs in a Suitelet. However, it's important to note that NetSuite has its own templating system and N/render module to create PDFs. The use of an external library should be the last resort when you are 100% sure you can’t do it with NetSuite. Here is a sample code provided by a user to generate a PDF using jsPDF:
html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js"></script>
<script>
function generatePDF() {
var pdf = new jsPDF({
orientation: 'p',
unit: 'mm',
format: 'a5',
putOnlyUsedFonts:true
});
pdf.setFontSize(15);
pdf.text("Invoice Group #", 90, 20);
pdf.setFontSize(10);
pdf.text("Samsung",30, 20);
pdf.text("3655 North First Street", 30, 25);
pdf.text("San Jose, CA 95134", 30, 30);
pdf.text("United States", 30, 35);
pdf.text("Bill Address",20, 50);
pdf.text("One Verizon Way", 20, 60);
pdf.text("Basking Ridge", 20, 65);
pdf.text("New Jersey, NJ, 07920", 20, 70);
pdf.text("United States", 20, 75);
pdf.rect(84,55,25,7);
pdf.text("Amount Paid",85, 60);
pdf.rect(109,55,30,7);
pdf.text("$0.00",120, 60);
pdf.rect(84,62,25,7);
pdf.text("Amount Due",85, 67);
pdf.rect(109,62,30,7);
pdf.text("$2,688.00",120, 67);
pdf.rect(84,69,25,7);
pdf.text("Amount Due",85, 74);
pdf.rect(109,69,30,7);
pdf.text("$2,688.00",120, 74);
pdf.addPage();
pdf.setFontSize(30)
pdf.text(20, 20, 'The second page');
pdf.save('jsPDF_2Pages.pdf');
// window.open("jsPDF_2Pages.pdf", '_blank');
}
</script>
</head>
<body>
<button onclick="generatePDF()">Generate PDF using jsPDF</button>
</body>
</html>
Please note that this code is not using SuiteScript 1.0, but it's a simple HTML file that uses jsPDF to generate a PDF.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
03/17/2025, 5:48 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835271537
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833551168
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830816686
Celigo AI
03/17/2025, 5:48 AM