mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
Update object.coffee code to eliminate .isString and .isRaw hacks and replace with the Buffer object so that anything can be supported.
This commit is contained in:
parent
ca8c3c38ff
commit
cba6f80b4e
@ -15,12 +15,9 @@ class PDFObject
|
||||
else if typeof object is 'string'
|
||||
'/' + object
|
||||
|
||||
else if object?.isString
|
||||
'(' + object + ')'
|
||||
|
||||
else if object?.isRaw
|
||||
object.toString()
|
||||
|
||||
else if Buffer.isBuffer(object)
|
||||
object.toString()
|
||||
|
||||
else if object instanceof PDFReference
|
||||
object.toString()
|
||||
|
||||
@ -67,10 +64,7 @@ class PDFObject
|
||||
if swap
|
||||
string = swapBytes(new Buffer('\ufeff' + string, 'ucs-2')).toString('binary')
|
||||
|
||||
return {
|
||||
isString: yes
|
||||
toString: -> string
|
||||
}
|
||||
return new Buffer("("+string+")")
|
||||
|
||||
module.exports = PDFObject
|
||||
PDFReference = require './reference'
|
||||
Loading…
x
Reference in New Issue
Block a user