mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
Make loading images from buffers way faster by not converting to a string inadvertently
This commit is contained in:
parent
50f2f84987
commit
665fd935ef
@ -12,12 +12,15 @@ module.exports =
|
||||
|
||||
x = x ? options.x ? @x
|
||||
y = y ? options.y ? @y
|
||||
|
||||
image = @_imageRegistry[src]
|
||||
|
||||
unless Buffer.isBuffer(src)
|
||||
image = @_imageRegistry[src]
|
||||
|
||||
if not image
|
||||
image = PDFImage.open src, 'I' + (++@_imageCount)
|
||||
image.embed this
|
||||
@_imageRegistry[src] = image unless Buffer.isBuffer(src)
|
||||
unless Buffer.isBuffer(src)
|
||||
@_imageRegistry[src] = image
|
||||
|
||||
@page.xobjects[image.label] ?= image.obj
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user