Permalink
Browse files

Fixed thanks to help from @chapel

  • Loading branch information...
1 parent 46f6510 commit c611594ec74209f802b1c232eb47cb7b4bff2b8e @niftylettuce committed Mar 11, 2012
Showing with 15 additions and 11 deletions.
  1. +3 −3 lib/document.coffee
  2. +12 −8 lib/store.coffee
View
@@ -73,10 +73,10 @@ class PDFDocument
return this
- removePage: ->
+ removePage: (options = @options) ->
# remove a page
- @pages.pop
-
+ @store.removePage @page
+ @pages.pop @page
return this
ref: (data) ->
View
@@ -9,27 +9,31 @@ class PDFObjectStore
constructor: ->
@objects = {}
@length = 0
-
+
@root = @ref
Type: 'Catalog'
-
+
@root.data['Pages'] = @ref
Type: 'Pages'
Count: 0
Kids: []
-
+
@pages = @root.data['Pages']
-
+
ref: (data) ->
@push ++@length, data
-
+
push: (id, data) ->
ref = new PDFReference(id, data)
@objects[id] = ref
return ref
-
+
addPage: (page) ->
@pages.data['Kids'].push(page.dictionary)
@pages.data['Count']++
-
-module.exports = PDFObjectStore
+
+ removePage: (page) ->
+ @pages.data['Kids'].pop(page.dictionary)
+ @pages.data['Count']--
+
+module.exports = PDFObjectStore

0 comments on commit c611594

Please sign in to comment.