How to use the pdfjs.cm function in pdfjs

To help you get started, we’ve selected a few pdfjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rkusa / pdfjs / types / pdfjs-tests.ts View on Github external
row2.cell("Cell Right");

const text2 = doc.text();
text2.add("add 1", { fontSize: 14 });
text2.br();
text2.add("add 2");
text.append("add3");
text.append("add4", { alignment: "justify" });

// from playground
const lorem = "lorem";
var docPlayground = new pdf.Document({ font: helveticaFont });

var header3 = docPlayground
    .header()
    .table({ widths: [null, null], paddingBottom: 1 * pdf.cm })
    .row();
header3.cell().image(logo, { height: 2 * pdf.cm });
header3
    .cell()
    .text({ textAlign: "right" })
    .add(
        "A Portable Document Format (PDF) generation library targeting both the server- and client-side."
    )
    .add("https://github.com/rkusa/pdfjs", {
        link: "https://github.com/rkusa/pdfjs",
        underline: true,
        color: 0x569cd6
    });

docPlayground.footer().pageNumber(
    function (curr: number, total: number) {
github rkusa / pdfjs / types / pdfjs-tests.ts View on Github external
"A Portable Document Format (PDF) generation library targeting both the server- and client-side."
    )
    .add("https://github.com/rkusa/pdfjs", {
        link: "https://github.com/rkusa/pdfjs",
        underline: true,
        color: 0x569cd6
    });

docPlayground.footer().pageNumber(
    function (curr: number, total: number) {
        return curr + " / " + total;
    },
    { textAlign: "center" }
);

let cell2 = docPlayground.cell({ paddingBottom: 0.5 * pdf.cm });
cell2.text("Features:", { fontSize: 16, font: helveticaBoldFont });
cell2
    .text({ fontSize: 14, lineHeight: 1.35 })
    .add("-")
    .add("different", { color: 0xf8dc3f })
    .add("font", { font: timesRomanFont })
    .add("styling", { underline: true })
    .add("options", { fontSize: 9 });
cell2.text("- Images (JPEGs, other PDFs)");
cell2.text("- Tables (fixed layout, header row)");
cell2.text(
    "- AFM fonts && OTF font embedding (as CID fonts, i.e., support for fonts with large character sets)"
);
cell2.text("- Add existing PDFs (merge them or add them as page templates)");

docPlayground

pdfjs

A Portable Document Format (PDF) generation library targeting both the server- and client-side.

MIT
Latest version published 11 months ago

Package Health Score

64 / 100
Full package analysis