Javascript – Create PDF How To


How to create PDF file using javascript?

Javascript – create PDF files with JS easily using Bytescout PDF Generator SDK for JavaScript. Use the source code below to simply create PDF in Javascript.

function CreatePDF(IsInternetExplorer8OrLower) {

   // create BytescoutPDF object instance (from bytescoutpdf.js)
   var pdf = new BytescoutPDF();
   // set document properties: Title, subject, keywords, author name and creator name
   pdf.propertiesSet("Sample document title", "Sample subject", "keyword1, keyword 2, keyword3", "Document Author Name", "Document Creator Name");
   
   // add 1st page
   pdf.pageAdd();
   // add page header with anchor
   pdf.textAdd(10, 20, 'sample pdf text', 0);
   
   // return BytescoutPDF object instance
   return pdf;
}

prev
next