Skip to content

Commit

Permalink
Added input and output for templates
Browse files Browse the repository at this point in the history
  • Loading branch information
alFReD-NSH committed Dec 25, 2011
1 parent d30168c commit 8a170eb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/document.coffee
Expand Up @@ -79,7 +79,9 @@ class PDFDocument
@store.ref(data) @store.ref(data)


addContent: (str) -> addContent: (str) ->
console.log @haveTemp
if @haveTemp is true if @haveTemp is true
console.log 'hi'
@temp.add str @temp.add str
else else
@page.content.add str @page.content.add str
Expand Down Expand Up @@ -121,14 +123,13 @@ class PDFDocument


generateBody: (out) -> generateBody: (out) ->
offset = out.join('\n').length offset = out.join('\n').length

for id, ref of @store.objects for id, ref of @store.objects
object = ref.object() object = ref.object()
ref.offset = offset ref.offset = offset
out.push object out.push object


offset += object.length + 1 offset += object.length + 1
console.log out
@xref_offset = offset @xref_offset = offset


generateXRef: (out) -> generateXRef: (out) ->
Expand Down Expand Up @@ -162,7 +163,13 @@ class PDFDocument
@haveTemp = true @haveTemp = true


endTemp: -> endTemp: ->
@temp.finalize @compress @temp.finalize true
@haveTemp = false @haveTemp = false

outputTemp: ->
@temp

inputTemp: (input)->
@store.objects[5] = input


module.exports = PDFDocument module.exports = PDFDocument

0 comments on commit 8a170eb

Please sign in to comment.