Error Message: Cannot invoke "java.io.ByteArrayOutputStream.toByteArray()" because "pdfOS" is null

ShitalB92986770
Tera Contributor

HI Team,

 

While generating PDF in Plan in BCM, i am getting "Error: Unable to generate PDF attachment".

When i dig into the code level, i found that error is coming from -

 var pdfGenerationAPI = new sn_pdfgeneratorutils.PDFGenerationAPI();
var response = pdfGenerationAPI.convertToPDFWithHeaderFooter(
        params.htmlBody,
        params.targetTable,
        params.targetSysId,
        params.generatedPdfName,
        _getHeaderFooterInfo(params.htmlTemplateGr),
        params.htmlTemplateGr.custom_font.toString(),
        documentConfiguration
    );
 
response is -  {"message":" Conversion failed. HTML to PDF conversion has failed with exception : Index 1 out of bounds for length 1","request_id":"***************************************","status":"failure"}
 
It's happening only for one record. I already tried by cleating cache on instance and on browser level.
Please let me know if anyone has any idea on this.
Thank you.
1 REPLY 1

Tanushree Maiti
Mega Sage

Hi ,

First go to All document template -> open your template which is generating pdf and confirm it is published

If it is not published, make it Publish 

And confirm here what result you are getting.

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: