Create PDF tutorial for Javascript shows how to generate PDF from Java Script using CreatePDF.js (Bytescout PDF Generator SDK for JS).
CreatePDF.js
function CreatePDF(IsInternetExplorer8OrLower) { // create BytescoutPDF object instance 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, '<a name="#page1"/><font face="Courier" size="15" color="#00ff00"><b><i>Page 1</i></b></font>', 0); // add link to page 2 by anchor pdf.textAdd(10, 50,'<u><font face="Helvetica" size="12" color="#0000ff"><a href="#page2">link to page #2 by anchor</a></font></u>', 0); // add link to page 3 by page number and offset ("#3#10") pdf.textAdd(10, 70,'<u><font face="Helvetica" size="12" color="#0000ff"><a href="#3#10">link to page #3 by page number and offset</a></font></u>', 0); // add 2nd page pdf.pageAdd(); // add page header with anchor pdf.textAdd(10, 20, '<a name="#page2"/><font face="Courier" size="15" color="#00ff00"><b><i>Page 2</i></b></font>', 0); // add link to page 1 by anchor pdf.textAdd(10, 50,'<u><font face="Helvetica" size="12" color="#0000ff"><a href="#page1">link to page #1 by anchor</a></font></u>', 0); // add link to page 3 by page number and offset pdf.textAdd(10, 70,'<u><font face="Helvetica" size="12" color="#0000ff"><a href="#3#0">link to page #3 by page number and offset</a></font></u>', 0); // add 3nd page pdf.pageAdd(); // add page header pdf.textAdd(10, 20, '<font face="Courier" size="15" color="#00ff00"><b><i>Page 3</i></b></font>', 0); // add link to page 1 by anchor pdf.textAdd(10, 50,'<u><font face="Helvetica" size="12" color="#0000ff"><a href="#page1">link to page #1 by anchor</a></font></u>', 0); // add link to page 2 by page number and offset pdf.textAdd(10, 70,'<u><font face="Helvetica" size="12" color="#0000ff"><a href="#2#0">link to page #2 by page number and offset</a></font></u>', 0); // add an external link pdf.pageSetIndex(1); // return back to the first page pdf.textAdd(100, 300, "link to google.com"); pdf.addLink(100, 280, 200, 30, 'http://www.google.com'); // return BytescoutPDF object instance return pdf; }