how to convert a word document attachment to pdf attachement and send as email notification

Sriramachandra
Tera Guru

how to convert a word document attachment to pdf attachement and send as email notification

3 REPLIES 3

Kieran Anson
Kilo Patron

Not aware of a native ability. You'll likely need to develop an integration and leverage a third party API to convert a document. Something like https://www.convertapi.com/doc-to-pdf

manjusha
Kilo Guru
Hi Shriramchandra, Use below link for reference https://community.servicenow.com/community?id=community_question&sys_id=676fb553dbd44cd0feb1a851ca96190a Mark this asnwer as correct if helps Thanks, Manjusha Bangale

Sudhanshu Talw1
Tera Guru

Hii, Make sure these 2 plugins are activated:

PDF Generator (com.snc.pdf_generator) 

WebKit HTML to PDF (com.snc.whtp)

Try with this one:

var PDF = Class.create();

PDF.prototype = Object.extendsObject(AbstractAjaxProcessor, 

  _document : null, 

  example : function (){

  this.createPDF('<p>Hello World!</p>',   //HTML to convert to PDF

    'incident',   //Attach PDF to table

    'd324db7d2b9aa20072675aa419da1547', //Attach PDF to record/sys_id

    'myFile.pdf');   //attachment filename

  },

  createPDF : function(html, table, sys_id, filename) {   var pdfDoc = new GeneralPDF.Document(null, null, null, null, null, null);

  this._document = new GeneralPDF(pdfDoc);

    this._document.startHTMLParser();

    this._document.addHTML(html);

  this._document.stopHTMLParser();

    this._saveAs(table, sys_id, filename);

  },

  •   _saveAs : function (table, sys_id, filename){

    var att = new GeneralPDF.Attachment();

    att.setTableName(table);

    att.setTableId(sys_id);

    att.setName(filename);

    att.setType('application/pdf');

    att.setBody(this._document.get());

    GeneralPDF.attach(att);

  },

      type: 'PDF'

});

This script include will convert the doc to pdf via code.

REST IS THE ATTACHMENT PART IN THE EMAIL WHICH YOU CAN MANAGE THEN.

 

Thanks

Sudhanshu