pdf-writer 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@
6
6
  # Licensed under a MIT-style licence. See LICENCE in the main distribution
7
7
  # for full licensing information.
8
8
  #
9
- # $Id: writer.rb 190 2007-12-11 07:16:27Z sandal $
9
+ # $Id: writer.rb 194 2007-12-13 18:19:02Z sandal $
10
10
  #++
11
11
  require 'thread'
12
12
  require 'open-uri'
@@ -19,7 +19,7 @@ require 'color'
19
19
  module PDF
20
20
  class Writer
21
21
  # The version of PDF::Writer.
22
- VERSION = '1.1.6'
22
+ VERSION = '1.1.7'
23
23
 
24
24
  # Escape the text so that it's safe for insertion into the PDF
25
25
  # document.
@@ -2155,11 +2155,7 @@ class PDF::Writer
2155
2155
  #
2156
2156
  # Each time page numbers are started, a new page number scheme will be
2157
2157
  # started. The scheme number will be returned.
2158
- def start_page_numbering(x, y, size, pos = nil, pattern = nil, starting = nil)
2159
- if starting
2160
- raise "We have currently disabled starting values for start_page_numbering" +
2161
- " because it is buggy."
2162
- end
2158
+ def start_page_numbering(x, y, size, pos = nil, pattern = nil, starting = nil)
2163
2159
  pos ||= :left
2164
2160
  pattern ||= "<PAGENUM> of <TOTALPAGENUM>"
2165
2161
  starting ||= 1
@@ -2268,6 +2264,7 @@ class PDF::Writer
2268
2264
  end
2269
2265
 
2270
2266
  status = nil
2267
+ delta = pattern = pos = x = y = size = nil
2271
2268
  pattern = pos = x = y = size = nil
2272
2269
 
2273
2270
  @pageset.each_with_index do |page, index|
@@ -2277,6 +2274,11 @@ class PDF::Writer
2277
2274
  if info
2278
2275
  if info[:start]
2279
2276
  status = true
2277
+ if info[:starting]
2278
+ delta = info[:starting] - index
2279
+ else
2280
+ delta = index
2281
+ end
2280
2282
 
2281
2283
  pattern = info[:pattern]
2282
2284
  pos = info[:pos]
@@ -2296,8 +2298,8 @@ class PDF::Writer
2296
2298
 
2297
2299
  if status
2298
2300
  # Add the page numbering to this page
2299
- num = index + 1
2300
- total = total_pages
2301
+ num = index + delta.to_i
2302
+ total = total_pages + num - index
2301
2303
  patt = pattern.gsub(/<PAGENUM>/, num.to_s).gsub(/<TOTALPAGENUM>/, total.to_s)
2302
2304
  reopen_object(page.contents.first)
2303
2305
 
@@ -6,7 +6,7 @@
6
6
  # Licensed under a MIT-style licence. See LICENCE in the main distribution
7
7
  # for full licensing information.
8
8
  #
9
- # $Id: action.rb 190 2007-12-11 07:16:27Z sandal $
9
+ # $Id: action.rb 188 2007-12-11 07:14:58Z sandal $
10
10
  #++
11
11
  # An action object, used to link to URLS initially
12
12
  class PDF::Writer::Object::Action < PDF::Writer::Object
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: pdf-writer
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.6
7
- date: 2007-12-11 00:00:00 -05:00
6
+ version: 1.1.7
7
+ date: 2007-12-13 00:00:00 -05:00
8
8
  summary: A pure Ruby PDF document creation library.
9
9
  require_paths:
10
10
  - lib