View Categories

Advanced TCPDF Configuration and Barcodes

PDF Invoices & Packing Slips Generator for WooCommerce renders documents with the TCPDF library. The Advanced Options in the General section let you tune that engine and even call TCPDF methods directly from your template. This reference explains each option and shows how to add a barcode.

All options below are in WPFactory > PDF Invoicing (also reachable at WooCommerce > Settings > PDF Invoicing), General section, Advanced Options.

Calling TCPDF methods from HTML #

When Use custom config and TCPDF methods in HTML are both enabled, you can invoke a TCPDF method from the template with the <tcpdf> tag. For security, only methods you whitelist in Allowed TCPDF methods can be called, each wrapped in pipe characters.

For example, to allow barcode methods, set Allowed TCPDF methods to:

|write1DBarcode|write2DBarcode|

Then in the document HTML content, add a QR code for the order number:

<tcpdf method="write2DBarcode" params="||QRCODE,H|||30|30" />

The [page_break mode="tcpdf"] shortcode uses the same mechanism to call AddPage.

Note: <tcpdf> calls run only when both Use custom config and TCPDF methods in HTML are on, and only for methods listed in Allowed TCPDF methods. Leave the whitelist empty if you do not need this, so no methods are exposed.

Advanced options reference #

Option Option ID Default Purpose
Suppress errors alg_wc_pdf_invoicing_suppress_errors Yes Prevents stray PHP notices from corrupting the PDF stream.
Use custom config alg_wc_pdf_invoicing_use_custom_tcpdf_config Yes Loads the plugin’s TCPDF config file.
TCPDF methods in HTML alg_wc_pdf_invoicing_use_custom_tcpdf_config_calls_in_html Yes Enables the <tcpdf> tag (requires Use custom config).
Allowed TCPDF methods alg_wc_pdf_invoicing_use_custom_tcpdf_config_allowed_tags (empty) Whitelist of callable TCPDF methods, pipe-wrapped.
Set default images directory alg_wc_pdf_invoicing_tcpdf_path_images Yes Uses the WordPress uploads folder as the base for image paths.
Early TCPDF load alg_wc_pdf_invoicing_tcpdf_early_load No Loads TCPDF early to resolve conflicts with other libraries.
Use Print.js alg_wc_pdf_invoicing_use_print_js Yes Uses Print.js for the Print action instead of a new tab.
Use monospace font alg_wc_pdf_invoicing_use_monospace_font No Monospace font in the HTML editor fields for easier code editing.
Shortcode prefix alg_wc_pdf_invoicing_shortcode_prefix (empty) Prefixes all plugin shortcodes to avoid clashes with other plugins.

Fonts #

Each document offers these fonts: DejaVu Sans (Unicode), Times New Roman, Helvetica, and Courier. If language-specific characters do not display, choose DejaVu Sans (Unicode), which has the widest coverage.

Need a hand? #

For help with a specific TCPDF method or barcode format, contact us on the PDF Invoicing support forum.