Skip to content

Mixing standard and embedded Helvetica font does not work #1651

@blikblum

Description

@blikblum

Bug Report

Description of the problem

A document with both embedded and standard font does not work. It creates a corrupt document. Docs with only embedded, works

Code sample

var fs = require('fs');
var PDFDocument = require('pdfkit');

var doc = new PDFDocument();
doc.registerFont('HelveticaCustom', './Helvetica.ttf');

doc.pipe(fs.createWriteStream('mixed-helvetica.pdf'));

// comment line below to make work
doc.text('standard')

doc.font('HelveticaCustom');
doc.text('embedded')

doc.end();

Your environment

  • pdfkit version: 0.17.2
  • Node version: 22
  • Browser version (if applicable):
  • Operating System: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions