This example demonstrates how to draw sybmols when creating PDF file in JavaScript with BytescoutPDF.js (Bytescout PDF Generator for JavaScript).
// function that creates BytescoutPDF instance (defined in BytescoutPDF.js script which have to be included into the same page)
// then calls API methods and properties to create PDF document
// and returns created BytescoutPDF object instance
// this CreatePDF() function is called from Sample.html
function CreatePDF() {
// 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 new page
pdf.pageAdd();
// set font size
pdf.fontSetSize(48);
// set Symbol symbolic font
pdf.fontSetName('Symbol');
// info: char table of Symbol font http://en.wikipedia.org/wiki/Symbol_font
pdf.textAdd(100, 50, 'u0041');
pdf.textAdd(200, 50, 'u0022');
// set ZapfDingbats symbolic font
pdf.fontSetName('ZapfDingbats');
// info: char table of ZapfDingbats font http://www.unicode.org/charts/PDF/U2700.pdf
pdf.textAdd(100, 150, "u2780");
pdf.textAdd(200, 150, "u2776");
// return BytescoutPDF object instance
return pdf;
}
Generated PDF file with different symbols (click to view full size):