Make loading images from buffers way faster by not converting to a string inadvertently

This commit is contained in:
Devon Govett 2014-04-06 19:19:17 -07:00
parent 50f2f84987
commit 665fd935ef

View File

@ -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