Aaron McCausland
08/19/2025, 8:03 PMCeligo AI
08/19/2025, 8:03 PMAI generated answer (using internal Slack threads):In NetSuite's Advanced PDF templates, you can't directly set a max-width or max-height while maintaining the image's aspect ratio. The BFO PDF Library, which NetSuite uses for Advanced PDFs, doesn't support the
max-width
or auto
properties for height/width.
However, you can use a workaround to achieve this. You can create a script that resizes the image before it's used in the PDF. This script would take the image, check its dimensions, and then resize it to fit within your desired max-width and max-height while maintaining the aspect ratio. This resized image can then be used in the PDF.
Here's a pseudo-code example of how this might work:
pseudo
function resizeImage(image, maxWidth, maxHeight) {
var width = image.width;
var height = image.height;
if (width > maxWidth || height > maxHeight) {
var ratio = Math.min(maxWidth / width, maxHeight / height);
return image.resize(width * ratio, height * ratio);
}
return image;
}
Please note that this is a workaround and might not work in all cases. Also, this requires some scripting knowledge and might not be suitable for all users.
******
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
08/19/2025, 8:03 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818868876
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80948
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.795720875
Celigo AI
08/19/2025, 8:03 PM