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:
Nathanael Anderson 2015-03-16 13:57:06 -05:00
parent ca8c3c38ff
commit cba6f80b4e

View File

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