rbpdf 1.18.5 → 1.18.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA512:
3
- data.tar.gz: 58ee6415442d443f581733352686a7ce871a2cfe04b5bf683544ba7e8202b934f7258d0c403942b07c52c2a56ad6288f02fb1bb210c1ca94401ca092729da139
4
- metadata.gz: fca83b46f3d2abdc1efea548a5a7c7963b1fbbbbdde7e6dbf7a1b279a80cb25bb628a4eba853eb064cdef79ea4ad514928b6d243f3b4c01bf42f03046c2a122f
5
- SHA1:
6
- data.tar.gz: a973c8fae4a4b576b68cd8e5a7dc3b73211e26ab
7
- metadata.gz: c27e1dfa12f3cbfbf8cee92658d17a99cff0a1e0
1
+ ---
2
+ SHA1:
3
+ metadata.gz: da1bf9dca7775d7e0b454cccc03c92e8983e9075
4
+ data.tar.gz: 2aa1f90e5d0e58774ef811a25a845085370e044a
5
+ SHA512:
6
+ metadata.gz: 8d42d61a6222d2b8cfd520ad9a200c0dac5415ef029bc0a69522cbe1947ac4fda75b6e21b46f8b17a579fbba2e781b0f2109538092f857bf9f881b0fb56d8b55
7
+ data.tar.gz: 9cff8bf012066f9954963282d66c976b403e24aa3458aac9e931149ab7f60b63d7103c13ee40469018ff97c1dcdcf1216e775152cdd4e80a9076c784c7551133
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 1.18.6 2015-06-20
2
+ - Fixed page boxes problem for iOS.
3
+ - The dependence to the Rails environment was reduced.
4
+ - Fixed Image tag's style attribute width/height parameter problem.
5
+ - Open angled bracket '<' by HTML sanitize bug fixed.
6
+
1
7
  1.18.5 2015-01-24
2
8
  - Rails 4.2 and Ruby 2.2 supported.
3
9
  - Fix Rails 4.2 (new HTML sanitizer) compatible.
data/lib/rbpdf.rb CHANGED
@@ -11,22 +11,22 @@
11
11
  # it under the terms of the GNU Lesser General Public License as published by
12
12
  # the Free Software Foundation, either version 2.1 of the License, or
13
13
  # (at your option) any later version.
14
- #
14
+ #
15
15
  # This program is distributed in the hope that it will be useful,
16
16
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
17
17
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
18
  # GNU Lesser General Public License for more details.
19
- #
19
+ #
20
20
  # You should have received a copy of the GNU Lesser General Public License
21
21
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
22
22
  # ----------------------------------------------------------------------------
23
23
  #
24
- # Description : This is a Ruby class for generating PDF files
25
- # on-the-fly without requiring external
24
+ # Description : This is a Ruby class for generating PDF files
25
+ # on-the-fly without requiring external
26
26
  # extensions.
27
27
  #
28
28
  # IMPORTANT:
29
- # This class is an extension and improvement of the Public Domain
29
+ # This class is an extension and improvement of the Public Domain
30
30
  # FPDF class by Olivier Plathey (http://www.fpdf.org).
31
31
  #
32
32
  # Main changes by Nicola Asuni:
@@ -49,10 +49,20 @@
49
49
  require "rbpdf/version"
50
50
 
51
51
  begin
52
- require('htmlentities')
52
+ require('htmlentities')
53
53
  rescue LoadError
54
54
  # This gem is not required - just nice to have.
55
55
  end
56
+
57
+ begin
58
+ # RMagick 2.14.0
59
+ # [DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead
60
+ # https://github.com/gemhome/rmagick/pull/141
61
+ require 'rmagick' unless Object.const_defined?(:Magick)
62
+ rescue LoadError
63
+ # RMagick is not available
64
+ end
65
+
56
66
  begin
57
67
  require 'RMagick' unless Object.const_defined?(:Magick)
58
68
  rescue LoadError
@@ -61,11 +71,16 @@ end
61
71
 
62
72
  require 'core/rmagick'
63
73
 
74
+ # Needed to run the test suite outside of a Rails environment.
75
+ require 'action_view'
76
+ require 'tempfile'
77
+ require 'uri'
78
+
64
79
  #
65
80
  # RBPDF Class.
66
81
  #
67
82
 
68
-
83
+
69
84
  PDF_PRODUCER = 'RBPDF 5.1.002'
70
85
 
71
86
  module RBPDFFontDescriptor
@@ -103,7 +118,14 @@ class RBPDF
103
118
  include Html_colors
104
119
 
105
120
  def logger
106
- Rails.logger
121
+ if defined? Rails.logger
122
+ Rails.logger
123
+ else
124
+ # This particular error will occur when the test suite is run from outside a Rails environment.
125
+ # We use the standard Ruby stdout logger in that case.
126
+ require 'logger'
127
+ return Logger.new(STDOUT)
128
+ end
107
129
  end
108
130
 
109
131
  @@version = "5.1.002"
@@ -115,13 +137,13 @@ class RBPDF
115
137
  cattr_accessor :k_blank_image
116
138
  @@k_blank_image = ""
117
139
 
118
- cattr_accessor :k_small_ratio
140
+ cattr_accessor :k_small_ratio
119
141
  @@k_small_ratio = 2/3.0
120
142
 
121
143
  cattr_accessor :k_path_cache
122
144
 
123
145
  cattr_accessor :k_path_main
124
-
146
+
125
147
  cattr_accessor :k_path_url
126
148
 
127
149
  @@k_path_images = ""
@@ -130,90 +152,90 @@ class RBPDF
130
152
  cattr_accessor :decoder
131
153
 
132
154
  attr_accessor :barcode
133
-
155
+
134
156
  attr_accessor :buffer
135
-
157
+
136
158
  attr_accessor :diffs
137
-
159
+
138
160
  attr_accessor :color_flag
139
-
161
+
140
162
  attr_accessor :default_font
141
163
 
142
164
  attr_accessor :draw_color
143
-
165
+
144
166
  attr_accessor :encoding
145
-
167
+
146
168
  attr_accessor :fill_color
147
-
169
+
148
170
  attr_accessor :fonts
149
-
171
+
150
172
  attr_accessor :font_family
151
-
173
+
152
174
  attr_accessor :font_files
153
-
175
+
154
176
  cattr_accessor :k_path_fonts
155
-
177
+
156
178
  attr_accessor :font_style
157
-
179
+
158
180
  attr_accessor :font_size_pt
159
-
181
+
160
182
  attr_accessor :header_width
161
-
183
+
162
184
  attr_accessor :header_logo
163
-
185
+
164
186
  attr_accessor :header_logo_width
165
-
187
+
166
188
  attr_accessor :header_title
167
-
189
+
168
190
  attr_accessor :header_string
169
-
191
+
170
192
  attr_accessor :images
171
-
193
+
172
194
  attr_accessor :img_scale
173
-
195
+
174
196
  attr_accessor :in_footer
175
-
197
+
176
198
  attr_accessor :is_unicode
177
199
 
178
200
  attr_accessor :lasth
179
-
201
+
180
202
  attr_accessor :links
181
-
203
+
182
204
  attr_accessor :listordered
183
-
205
+
184
206
  attr_accessor :listcount
185
-
207
+
186
208
  attr_accessor :lispacer
187
-
209
+
188
210
  attr_accessor :n
189
-
211
+
190
212
  attr_accessor :offsets
191
-
213
+
192
214
  attr_accessor :page
193
-
215
+
194
216
  attr_accessor :pages
195
-
217
+
196
218
  attr_accessor :pdf_version
197
-
219
+
198
220
  attr_accessor :print_header
199
-
221
+
200
222
  attr_accessor :print_footer
201
-
223
+
202
224
  attr_accessor :state
203
-
225
+
204
226
  attr_accessor :text_color
205
-
227
+
206
228
  attr_accessor :underline
207
-
229
+
208
230
  attr_accessor :diskcache
209
231
 
210
232
  attr_accessor :cache_file_length
211
233
 
212
234
  attr_accessor :prev_pages
213
-
235
+
214
236
  #
215
- # This is the class constructor.
216
- # It allows to set up the page format, the orientation and
237
+ # This is the class constructor.
238
+ # It allows to set up the page format, the orientation and
217
239
  # the measure unit used in all the methods (except for the font sizes).
218
240
  # @since 1.0
219
241
  # [@param string :orientation]
@@ -242,27 +264,36 @@ class RBPDF
242
264
  # [@access public]
243
265
  #
244
266
  def initialize(orientation = 'P', unit = 'mm', format = 'A4', unicode = true, encoding = "UTF-8", diskcache = false)
245
-
267
+
246
268
  # Set internal character encoding to ASCII#
247
- #FIXME 2007-05-25 (EJM) Level=0 -
269
+ #FIXME 2007-05-25 (EJM) Level=0 -
248
270
  # if (respond_to?("mb_internal_encoding") and mb_internal_encoding())
249
271
  # @internal_encoding = mb_internal_encoding();
250
272
  # mb_internal_encoding("ASCII");
251
273
  # }
252
274
 
253
- @@k_path_cache = Rails.root.join('tmp').to_s
254
- @@k_path_main = Rails.root.join('tmp').to_s
255
- @@k_path_url = Rails.root.join('tmp').to_s
275
+ if defined? Rails.root
276
+ @@k_path_cache = Rails.root.join('tmp').to_s
277
+ @@k_path_main = Rails.root.join('tmp').to_s
278
+ @@k_path_url = Rails.root.join('tmp').to_s
279
+ else
280
+ # This particular error will occur when the test suite is run from outside a Rails environment.
281
+ # We want to use the system's temp directory in that case.
282
+ require 'tmpdir'
283
+ @@k_path_cache = Dir.tmpdir
284
+ @@k_path_main = Dir.tmpdir
285
+ @@k_path_url = Dir.tmpdir
286
+ end
256
287
 
257
288
  # set disk caching
258
289
  @diskcache = diskcache ? true : false
259
-
290
+
260
291
  # set language direction
261
292
  @rtl = false
262
293
  @tmprtl = false
263
294
 
264
- @x ||= 0
265
- @y ||= 0
295
+ @x ||= 0
296
+ @y ||= 0
266
297
 
267
298
  #######################
268
299
  @offsets ||= []
@@ -351,7 +382,7 @@ class RBPDF
351
382
  @cache_utf8_string_to_array = {}
352
383
  @cache_maxsize_utf8_string_to_array = 8
353
384
  @cache_size_utf8_string_to_array = 0
354
-
385
+
355
386
  @signature_data ||= {}
356
387
  @sig_annot_ref ||= '***SIGANNREF*** 0 R'
357
388
  @page_obj_id ||= []
@@ -371,7 +402,7 @@ class RBPDF
371
402
  @current_column ||= 0
372
403
  @column_start_page ||= 0
373
404
 
374
- # Text rendering mode:
405
+ # Text rendering mode:
375
406
  # 0 = Fill text;
376
407
  # 1 = Stroke text;
377
408
  # 2 = Fill, then stroke text;
@@ -390,13 +421,13 @@ class RBPDF
390
421
 
391
422
  #Some checks
392
423
  dochecks();
393
-
424
+
394
425
  begin
395
- @@decoder = HTMLEntities.new
426
+ @@decoder = HTMLEntities.new
396
427
  rescue
397
428
  @@decoder = nil
398
429
  end
399
-
430
+
400
431
  #Initialization of properties
401
432
  @is_unicode = unicode
402
433
  @page ||= 0
@@ -433,7 +464,7 @@ class RBPDF
433
464
  # encryption values
434
465
  @encrypted ||= false
435
466
  @last_enc_key ||= ''
436
-
467
+
437
468
  # Standard Unicode fonts
438
469
  @core_fonts = {
439
470
  'courier'=>'Courier',
@@ -513,7 +544,7 @@ class RBPDF
513
544
  @curr_annot_obj_id ||= @annots_start_obj_id
514
545
  @apxo_obj_id ||= @apxo_start_obj_id
515
546
  end
516
-
547
+
517
548
  #
518
549
  # Set the units of measure for the document.
519
550
  # [@param string :unit]
@@ -704,9 +735,9 @@ class RBPDF
704
735
  end
705
736
  pf = getPageSizeFromFormat(format['format'])
706
737
  end
707
- setPageBoxes(@page, 'MediaBox', 0, 0, pf[0], pf[1])
708
- @fw_pt = pf[0] * @k
709
- @fh_pt = pf[1] * @k
738
+ @fw_pt = pf[0]
739
+ @fh_pt = pf[1]
740
+ setPageBoxes(@page, 'MediaBox', 0, 0, @fw_pt, @fh_pt, true)
710
741
  end
711
742
  # the visible region of default user space
712
743
  if format['CropBox']
@@ -788,7 +819,7 @@ class RBPDF
788
819
  # Set page boundaries.
789
820
  # [@param int :page] page number
790
821
  # [@param string :type]
791
- # valid values are:
822
+ # valid values are:
792
823
  # * 'MediaBox' : the boundaries of the physical medium on which the page shall be displayed or printed
793
824
  # * 'CropBox' : the visible region of default user space
794
825
  # * 'BleedBox' : the region to which the contents of the page shall be clipped when output in a production environment
@@ -798,23 +829,26 @@ class RBPDF
798
829
  # [@param float :lly] lower-left y coordinate in user units
799
830
  # [@param float :urx] upper-right x coordinate in user units
800
831
  # [@param float :ury] upper-right y coordinate in user units
832
+ # [@param boolean :points] if true uses user units as unit of measure, if false uses PDF points
801
833
  # [@access public]
802
834
  # [@since 5.0.010 (2010-05-17)]
803
835
  #
804
- def setPageBoxes(page, type, llx, lly, urx, ury)
805
- if @pagedim[@page].nil?
806
- # initialize array
807
- @pagedim[@page] = {}
808
- end
836
+ def setPageBoxes(page, type, llx, lly, urx, ury, points=false)
809
837
  pageboxes = ['MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox']
810
838
  unless pageboxes.include?(type)
811
839
  return
812
840
  end
841
+ if @pagedim[page].nil?
842
+ # initialize array
843
+ @pagedim[page] = {}
844
+ end
845
+
846
+ points ? k = 1 : k = @k
813
847
  @pagedim[page][type] = {}
814
- @pagedim[page][type]['llx'] = llx * @k
815
- @pagedim[page][type]['lly'] = lly * @k
816
- @pagedim[page][type]['urx'] = urx * @k
817
- @pagedim[page][type]['ury'] = ury * @k
848
+ @pagedim[page][type]['llx'] = llx * k
849
+ @pagedim[page][type]['lly'] = lly * k
850
+ @pagedim[page][type]['urx'] = urx * k
851
+ @pagedim[page][type]['ury'] = ury * k
818
852
  end
819
853
  alias_method :set_page_boxes, :setPageBoxes
820
854
 
@@ -854,23 +888,23 @@ class RBPDF
854
888
  def setPageOrientation(orientation, autopagebreak='', bottommargin='')
855
889
  if @pagedim[@page].nil? or @pagedim[@page]['MediaBox'].nil?
856
890
  # the boundaries of the physical medium on which the page shall be displayed or printed
857
- setPageBoxes(@page, 'MediaBox', 0, 0, (@fw_pt / @k), (@fh_pt / @k))
891
+ setPageBoxes(@page, 'MediaBox', 0, 0, @fw_pt, @fh_pt, true)
858
892
  end
859
893
  if @pagedim[@page]['CropBox'].nil?
860
894
  # the visible region of default user space
861
- setPageBoxes(@page, 'CropBox', @pagedim[@page]['MediaBox']['llx'], @pagedim[@page]['MediaBox']['lly'], @pagedim[@page]['MediaBox']['urx'], @pagedim[@page]['MediaBox']['ury'])
895
+ setPageBoxes(@page, 'CropBox', @pagedim[@page]['MediaBox']['llx'], @pagedim[@page]['MediaBox']['lly'], @pagedim[@page]['MediaBox']['urx'], @pagedim[@page]['MediaBox']['ury'], true)
862
896
  end
863
897
  if @pagedim[@page]['BleedBox'].nil?
864
898
  # the region to which the contents of the page shall be clipped when output in a production environment
865
- setPageBoxes(@page, 'BleedBox', @pagedim[@page]['CropBox']['llx'], @pagedim[@page]['CropBox']['lly'], @pagedim[@page]['CropBox']['urx'], @pagedim[@page]['CropBox']['ury'])
899
+ setPageBoxes(@page, 'BleedBox', @pagedim[@page]['CropBox']['llx'], @pagedim[@page]['CropBox']['lly'], @pagedim[@page]['CropBox']['urx'], @pagedim[@page]['CropBox']['ury'], true)
866
900
  end
867
901
  if @pagedim[@page]['TrimBox'].nil?
868
902
  # the intended dimensions of the finished page after trimming
869
- setPageBoxes(@page, 'TrimBox', @pagedim[@page]['CropBox']['llx'], @pagedim[@page]['CropBox']['lly'], @pagedim[@page]['CropBox']['urx'], @pagedim[@page]['CropBox']['ury'])
903
+ setPageBoxes(@page, 'TrimBox', @pagedim[@page]['CropBox']['llx'], @pagedim[@page]['CropBox']['lly'], @pagedim[@page]['CropBox']['urx'], @pagedim[@page]['CropBox']['ury'], true)
870
904
  end
871
905
  if @pagedim[@page]['ArtBox'].nil?
872
906
  # the page's meaningful content (including potential white space)
873
- setPageBoxes(@page, 'ArtBox', @pagedim[@page]['CropBox']['llx'], @pagedim[@page]['CropBox']['lly'], @pagedim[@page]['CropBox']['urx'], @pagedim[@page]['CropBox']['ury'])
907
+ setPageBoxes(@page, 'ArtBox', @pagedim[@page]['CropBox']['llx'], @pagedim[@page]['CropBox']['lly'], @pagedim[@page]['CropBox']['urx'], @pagedim[@page]['CropBox']['ury'], true)
874
908
  end
875
909
  if @pagedim[@page]['Rotate'].nil?
876
910
  # The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
@@ -1054,7 +1088,7 @@ class RBPDF
1054
1088
  warn "[DEPRECATION] 'SetImageScale' is deprecated. Please use 'set_image_scale' instead."
1055
1089
  setImageScale(scale)
1056
1090
  end
1057
-
1091
+
1058
1092
  #
1059
1093
  # Returns the adjusting factor to convert pixels to user units.
1060
1094
  # [@return float] adjusting factor to convert pixels to user units.
@@ -1066,7 +1100,7 @@ class RBPDF
1066
1100
  return @img_scale;
1067
1101
  end
1068
1102
  alias_method :get_image_scale, :getImageScale
1069
-
1103
+
1070
1104
  def GetImageScale()
1071
1105
  warn "[DEPRECATION] 'GetImageScale' is deprecated. Please use 'get_image_scale' instead."
1072
1106
  getImageScale()
@@ -1095,7 +1129,7 @@ class RBPDF
1095
1129
  # @pagedim[@page]['trans']['Dm'] = (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
1096
1130
  # @pagedim[@page]['trans']['M'] = (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
1097
1131
  # @pagedim[@page]['trans']['Di'] = (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
1098
- # @pagedim[@page]['trans']['SS'] = (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
1132
+ # @pagedim[@page]['trans']['SS'] = (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
1099
1133
  # @pagedim[@page]['trans']['B'] = (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
1100
1134
  # @pagedim[@page]['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed
1101
1135
  # @pagedim[@page]['MediaBox']['llx'] = lower-left x coordinate in points
@@ -1152,7 +1186,7 @@ class RBPDF
1152
1186
  warn "[DEPRECATION] 'GetPageWidth' is deprecated. Please use 'get_page_width' instead."
1153
1187
  getPageWidth()
1154
1188
  end
1155
-
1189
+
1156
1190
  #
1157
1191
  # Returns the page height in units.
1158
1192
  # [@return int] page height.
@@ -1164,7 +1198,7 @@ class RBPDF
1164
1198
  return @h;
1165
1199
  end
1166
1200
  alias_method :get_page_height, :getPageHeight
1167
-
1201
+
1168
1202
  def GetPageHeight()
1169
1203
  warn "[DEPRECATION] 'GetPageHeight' is deprecated. Please use 'get_page_height' instead."
1170
1204
  getPageHeight()
@@ -1696,7 +1730,7 @@ class RBPDF
1696
1730
  end
1697
1731
  end
1698
1732
  alias_method :end_page, :endPage
1699
-
1733
+
1700
1734
  #
1701
1735
  # Starts a new page to the document. The page must be closed using the endPage() function.
1702
1736
  # The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.
@@ -1803,7 +1837,7 @@ class RBPDF
1803
1837
  @header_string = hs || ""
1804
1838
  end
1805
1839
  alias_method :set_header_data, :setHeaderData
1806
-
1840
+
1807
1841
  def SetHeaderData(ln="", lw=0, ht="", hs="")
1808
1842
  warn "[DEPRECATION] 'SetHeaderData' is deprecated. Please use 'set_header_data' instead."
1809
1843
  setHeaderData(ln, lw, ht, hs)
@@ -1839,7 +1873,7 @@ class RBPDF
1839
1873
  @header_margin = hm;
1840
1874
  end
1841
1875
  alias_method :set_header_margin, :setHeaderMargin
1842
-
1876
+
1843
1877
  def SetHeaderMargin(hm=10)
1844
1878
  warn "[DEPRECATION] 'SetHeaderMargin' is deprecated. Please use 'set_header_margin' instead."
1845
1879
  setHeaderMargin(hm)
@@ -1866,7 +1900,7 @@ class RBPDF
1866
1900
  @footer_margin = fm;
1867
1901
  end
1868
1902
  alias_method :set_footer_margin, :setFooterMargin
1869
-
1903
+
1870
1904
  def SetFooterMargin(fm=10)
1871
1905
  warn "[DEPRECATION] 'SetFooterMargin' is deprecated. Please use 'set_footer_margin' instead."
1872
1906
  setFooterMargin(fm)
@@ -1885,14 +1919,14 @@ class RBPDF
1885
1919
 
1886
1920
  #
1887
1921
  # Set a flag to print page header.
1888
- # [@param boolean :val] set to true to print the page header (default), false otherwise.
1922
+ # [@param boolean :val] set to true to print the page header (default), false otherwise.
1889
1923
  # [@access public]
1890
1924
  #
1891
1925
  def setPrintHeader(val=true)
1892
1926
  @print_header = val;
1893
1927
  end
1894
1928
  alias_method :set_print_header, :setPrintHeader
1895
-
1929
+
1896
1930
  def SetPrintHeader(val=true)
1897
1931
  warn "[DEPRECATION] 'SetPrintHeader' is deprecated. Please use 'set_print_header' instead."
1898
1932
  setPrintHeader(val)
@@ -1900,14 +1934,14 @@ class RBPDF
1900
1934
 
1901
1935
  #
1902
1936
  # Set a flag to print page footer.
1903
- # [@param boolean :value] set to true to print the page footer (default), false otherwise.
1937
+ # [@param boolean :value] set to true to print the page footer (default), false otherwise.
1904
1938
  # [@access public]
1905
1939
  #
1906
1940
  def setPrintFooter(val=true)
1907
1941
  @print_footer = val;
1908
1942
  end
1909
1943
  alias_method :set_print_footer, :setPrintFooter
1910
-
1944
+
1911
1945
  def SetPrintFooter(val=true)
1912
1946
  warn "[DEPRECATION] 'SetPrintFooter' is deprecated. Please use 'set_print_footer' instead."
1913
1947
  setPrintFooter(val)
@@ -1983,9 +2017,9 @@ class RBPDF
1983
2017
  Cell(0, 0, '', 'T', 0, 'C')
1984
2018
  end
1985
2019
  alias_method :header, :Header
1986
-
2020
+
1987
2021
  #
1988
- # This method is used to render the page footer.
2022
+ # This method is used to render the page footer.
1989
2023
  # It is automatically called by AddPage() and could be overwritten in your own inherited class.
1990
2024
  # [@access public]
1991
2025
  #
@@ -2020,9 +2054,9 @@ class RBPDF
2020
2054
  end
2021
2055
  end
2022
2056
  alias_method :footer, :Footer
2023
-
2057
+
2024
2058
  #
2025
- # This method is used to render the page header.
2059
+ # This method is used to render the page header.
2026
2060
  # [@access protected]
2027
2061
  # [@since 4.0.012 (2008-07-24)]
2028
2062
  #
@@ -2059,7 +2093,7 @@ class RBPDF
2059
2093
  protected :setHeader
2060
2094
 
2061
2095
  #
2062
- # This method is used to render the page footer.
2096
+ # This method is used to render the page footer.
2063
2097
  # [@access protected]
2064
2098
  # [@since 4.0.012 (2008-07-24)]
2065
2099
  #
@@ -2106,7 +2140,7 @@ class RBPDF
2106
2140
  protected :setFooter
2107
2141
 
2108
2142
  #
2109
- # This method is used to render the table header on new page (if any).
2143
+ # This method is used to render the table header on new page (if any).
2110
2144
  # [@access protected]
2111
2145
  # [@since 4.5.030 (2009-03-25)]
2112
2146
  #
@@ -2184,8 +2218,8 @@ class RBPDF
2184
2218
  alias_method :add_spot_color, :AddSpotColor
2185
2219
 
2186
2220
  #
2187
- # Defines the color used for all drawing operations (lines, rectangles and cell borders).
2188
- # It can be expressed in RGB components or gray scale.
2221
+ # Defines the color used for all drawing operations (lines, rectangles and cell borders).
2222
+ # It can be expressed in RGB components or gray scale.
2189
2223
  # The method can be called before the first page is created and the value is retained from page to page.
2190
2224
  # [@param array or ordered hash :color] array(or ordered hash) of colors
2191
2225
  # [@access public]
@@ -2256,8 +2290,8 @@ class RBPDF
2256
2290
  alias_method :set_draw_color, :SetDrawColor
2257
2291
 
2258
2292
  #
2259
- # Defines the color used for all filling operations (filled rectangles and cell backgrounds).
2260
- # It can be expressed in RGB components or gray scale.
2293
+ # Defines the color used for all filling operations (filled rectangles and cell backgrounds).
2294
+ # It can be expressed in RGB components or gray scale.
2261
2295
  # The method can be called before the first page is created and the value is retained from page to page.
2262
2296
  # [@param array or ordered hash :color] array(or ordered hash) of colors
2263
2297
  # [@access public]
@@ -2347,7 +2381,7 @@ class RBPDF
2347
2381
  alias_method :set_cmyk_fill_color, :SetCmykFillColor
2348
2382
  =end
2349
2383
  #
2350
- # Defines the color used for text. It can be expressed in RGB components or gray scale.
2384
+ # Defines the color used for text. It can be expressed in RGB components or gray scale.
2351
2385
  # The method can be called before the first page is created and the value is retained from page to page.
2352
2386
  # [@param array or ordered hash :color] array(or ordered hash) of colors
2353
2387
  # [@access public]
@@ -2429,7 +2463,7 @@ class RBPDF
2429
2463
  end
2430
2464
  alias_method :set_cmyk_text_color, :SetCmykTextColor
2431
2465
  =end
2432
-
2466
+
2433
2467
  #
2434
2468
  # Returns the length of a string in user unit. A font must be selected.
2435
2469
  # [@param string :s] The string whose length is to be computed
@@ -2543,7 +2577,7 @@ class RBPDF
2543
2577
  def GetNumChars(s)
2544
2578
  if (@current_font['type'] == 'TrueTypeUnicode') or (@current_font['type'] == 'cidfont0')
2545
2579
  return UTF8StringToArray(s).length
2546
- end
2580
+ end
2547
2581
  return s.length
2548
2582
  end
2549
2583
  alias_method :get_num_chars, :GetNumChars
@@ -2562,9 +2596,9 @@ class RBPDF
2562
2596
  # Imports a TrueType, Type1, core, or CID0 font and makes it available.
2563
2597
  # It is necessary to generate a font definition file first with the makefont.rb utility.
2564
2598
  # The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by FPDF_FONTPATH if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
2565
- #
2599
+ #
2566
2600
  # === Example
2567
- #
2601
+ #
2568
2602
  # :pdf.add_font('Comic','I')
2569
2603
  # # is equivalent to:
2570
2604
  # :pdf.add_font('Comic','I','comici.rb')
@@ -2732,7 +2766,7 @@ class RBPDF
2732
2766
  if desc['ItalicAngle']
2733
2767
  desc['ItalicAngle'] -= 11
2734
2768
  else
2735
- desc['ItalicAngle'] = -11
2769
+ desc['ItalicAngle'] = -11
2736
2770
  end
2737
2771
  end
2738
2772
  setFontBuffer(fontkey, {'i' => @numfonts, 'type' => font_desc[:type], 'name' => sname, 'desc' => desc, 'cidinfo' => font_desc[:cidinfo], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'dw' => font_desc[:dw], 'enc' => font_desc[:enc]})
@@ -3111,7 +3145,7 @@ class RBPDF
3111
3145
  # [@param int :fill] Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
3112
3146
  # [@param mixed :link] URL or identifier returned by AddLink().
3113
3147
  # [@param int :stretch]
3114
- # stretch carachter mode:
3148
+ # stretch carachter mode:
3115
3149
  # * 0 = disabled
3116
3150
  # * 1 = horizontal scaling only if necessary
3117
3151
  # * 2 = forced horizontal scaling
@@ -3767,7 +3801,7 @@ class RBPDF
3767
3801
  # [@param float :y] y position in user units
3768
3802
  # [@param boolean :reseth] if true reset the last cell height (default true).
3769
3803
  # [@param int :stretch]
3770
- # stretch carachter mode:
3804
+ # stretch carachter mode:
3771
3805
  # * 0 = disabled
3772
3806
  # * 1 = horizontal scaling only if necessary
3773
3807
  # * 2 = forced horizontal scaling
@@ -3790,7 +3824,7 @@ class RBPDF
3790
3824
  # set row height
3791
3825
  @lasth = @font_size * @cell_height_ratio
3792
3826
  end
3793
-
3827
+
3794
3828
  if !empty_string(y)
3795
3829
  SetY(y)
3796
3830
  else
@@ -3950,7 +3984,7 @@ class RBPDF
3950
3984
  setPageBuffer(@page, pstart + ccode + "\n" + pend)
3951
3985
  end
3952
3986
  end
3953
-
3987
+
3954
3988
  # Get end-of-cell Y position
3955
3989
  currentY = GetY()
3956
3990
 
@@ -4133,7 +4167,7 @@ class RBPDF
4133
4167
  #
4134
4168
  # This method return the estimated needed height for print a simple text string in Multicell() method.
4135
4169
  # Generally, if you want to know the exact height for a block of content you can use the following technique:
4136
- #
4170
+ #
4137
4171
  # # store current object
4138
4172
  # pdf.start_transaction()
4139
4173
  # # store starting values
@@ -4166,7 +4200,7 @@ class RBPDF
4166
4200
  # end
4167
4201
  # # restore previous object
4168
4202
  # pdf = pdf.rollbackTransaction()
4169
- #
4203
+ #
4170
4204
  # [@param float :w] Width of cells. If 0, they extend up to the right margin of the page.
4171
4205
  # [@param string :txt] String for calculating his height
4172
4206
  # [@param boolean :reseth] if true reset the last cell height (default false).
@@ -4282,7 +4316,7 @@ class RBPDF
4282
4316
  else
4283
4317
  w = @w - @r_margin - @x
4284
4318
  end
4285
-
4319
+
4286
4320
  # max column width
4287
4321
  wmax = w - (2 * @c_margin)
4288
4322
  if !firstline and (chrwidth > wmax or (GetCharWidth(chars[0]) > wmax))
@@ -4357,7 +4391,7 @@ class RBPDF
4357
4391
  end
4358
4392
  w = getRemainingWidth()
4359
4393
  wmax = w - (2 * @c_margin)
4360
- else
4394
+ else
4361
4395
  # 160 is the non-breaking space, 173 is SHY (Soft Hypen)
4362
4396
  if (c != 160) and ((unichr(c) =~ /\s/) or (c == 173))
4363
4397
  # update last blank space position
@@ -4372,7 +4406,7 @@ class RBPDF
4372
4406
  tmp_shy_replacement_width = shy_replacement_width
4373
4407
  tmp_shy_replacement_char = shy_replacement_char
4374
4408
  end
4375
- else
4409
+ else
4376
4410
  shy = false
4377
4411
  end
4378
4412
  end
@@ -4688,8 +4722,8 @@ class RBPDF
4688
4722
  alias_method :get_image_file_type, :getImageFileType
4689
4723
 
4690
4724
  #
4691
- # Puts an image in the page.
4692
- # The upper-left corner must be given.
4725
+ # Puts an image in the page.
4726
+ # The upper-left corner must be given.
4693
4727
  # The dimensions can be specified in different ways:
4694
4728
  # * explicit width and height (expressed in user unit)
4695
4729
  # * one explicit dimension, the other being calculated automatically in order to keep the original proportions
@@ -5037,7 +5071,7 @@ class RBPDF
5037
5071
  #Read whole file
5038
5072
  data='';
5039
5073
  open(file,'rb') do |f|
5040
- data<<f.read();
5074
+ data << f.read()
5041
5075
  end
5042
5076
  return {'w' => a[0],'h' => a[1],'cs' => colspace,'bpc' => bpc,'f'=>'DCTDecode','data' => data}
5043
5077
  end
@@ -5045,10 +5079,10 @@ class RBPDF
5045
5079
 
5046
5080
  def imageToPNG(file)
5047
5081
  img = Magick::ImageList.new(file)
5048
- img.format = 'PNG' # convert to PNG from gif
5049
- if img.alpha?
5082
+ img.format = 'PNG' # convert to PNG from gif
5083
+ if img.alpha?
5050
5084
  img.opacity = 0 # PNG alpha channel delete
5051
- if img.alpha?
5085
+ if img.alpha?
5052
5086
  return false
5053
5087
  end
5054
5088
  end
@@ -5244,7 +5278,7 @@ class RBPDF
5244
5278
  protected :ImagePngAlpha
5245
5279
 
5246
5280
  #
5247
- # Performs a line break.
5281
+ # Performs a line break.
5248
5282
  # The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.
5249
5283
  # [@param float :h] The height of the break. By default, the value equals the height of the last printed cell.
5250
5284
  # [@param boolean :cell] if true add a c_margin to the x coordinate
@@ -6238,7 +6272,7 @@ protected
6238
6272
  annots << ' /SW /' + pl['opt']['mk']['if']['sw']
6239
6273
  end
6240
6274
  if_s = ['A', 'P']
6241
- if pl['opt']['mk']['if']['s'] and if_s.include?(pl['opt']['mk']['if']['s'])
6275
+ if pl['opt']['mk']['if']['s'] and if_s.include?(pl['opt']['mk']['if']['s'])
6242
6276
  annots << ' /S /' + pl['opt']['mk']['if']['s']
6243
6277
  end
6244
6278
  if pl['opt']['mk']['if']['a'] and pl['opt']['mk']['if']['a'].is_a?(Array) and !pl['opt']['mk']['if']['a'].empty?
@@ -6707,14 +6741,14 @@ protected
6707
6741
  out << ' >>'
6708
6742
  out << ' endobj'
6709
6743
  out(out)
6710
-
6744
+
6711
6745
  # CIDFontType2
6712
6746
  # A CIDFont whose glyph descriptions are based on TrueType font technology
6713
6747
  newobj();
6714
6748
  out = '<</Type /Font'
6715
6749
  out << ' /Subtype /CIDFontType2'
6716
6750
  out << ' /BaseFont /' + font['name']
6717
-
6751
+
6718
6752
  # A dictionary containing entries that define the character collection of the CIDFont.
6719
6753
 
6720
6754
  cidinfo = '/Registry ' + datastring(font['cidinfo']['Registry'])
@@ -6727,7 +6761,7 @@ protected
6727
6761
  out << "\n" + putfontwidths(font, 0)
6728
6762
  out << ' /CIDToGIDMap ' + (@n + 2).to_s + ' 0 R >> endobj'
6729
6763
  out(out)
6730
-
6764
+
6731
6765
  # Font descriptor
6732
6766
  # A font descriptor describing the CIDFont default metrics other than its glyph widths
6733
6767
  newobj();
@@ -6771,8 +6805,8 @@ protected
6771
6805
  size = File.size(fontfile)
6772
6806
  out = '<</Length ' + size.to_s + ''
6773
6807
  if (fontfile[-2,2] == '.z') # check file extension
6774
- # Decompresses data encoded using the public-domain
6775
- # zlib/deflate compression method, reproducing the
6808
+ # Decompresses data encoded using the public-domain
6809
+ # zlib/deflate compression method, reproducing the
6776
6810
  # original text or binary data
6777
6811
  out << ' /Filter /FlateDecode'
6778
6812
  end
@@ -6955,7 +6989,7 @@ protected
6955
6989
  out << ' /Properties <</OC1 ' + @n_ocg_print.to_s + ' 0 R /OC2 ' + @n_ocg_view.to_s + ' 0 R>>'
6956
6990
  # transparency
6957
6991
  out << ' /ExtGState <<'
6958
- @extgstates.each_with_index { |extgstate, k|
6992
+ @extgstates.each_with_index { |extgstate, k|
6959
6993
  if extgstate
6960
6994
  if extgstate['name']
6961
6995
  out << ' /' + extgstate['name']
@@ -7016,7 +7050,7 @@ protected
7016
7050
 
7017
7051
  ### T.B.D ### TCPDF 5.0.000 ###
7018
7052
  end
7019
-
7053
+
7020
7054
  #
7021
7055
  # Adds some Metadata information (Document Information Dictionary)
7022
7056
  # * (see Chapter 14.3.3 Document Information Dictionary of PDF32000_2008.pdf Reference)
@@ -7118,7 +7152,7 @@ protected
7118
7152
  # [@since 3.1.000 (2008-06-09)]
7119
7153
  # [@access protected]
7120
7154
  #
7121
- def putviewerpreferences()
7155
+ def putviewerpreferences()
7122
7156
  out = '/ViewerPreferences <<'
7123
7157
  if @rtl
7124
7158
  out << ' /Direction /R2L'
@@ -7576,7 +7610,7 @@ protected
7576
7610
  # Converts UTF-8 strings to codepoints array.
7577
7611
  # Invalid byte sequences will be replaced with 0xFFFD (replacement character)
7578
7612
  # * Based on: http://www.faqs.org/rfcs/rfc3629.html
7579
- #
7613
+ #
7580
7614
  # Char. number range | UTF-8 octet sequence
7581
7615
  # (hexadecimal) | (binary)
7582
7616
  # --------------------+------------------------------------------------
@@ -7634,17 +7668,17 @@ protected
7634
7668
  numbytes = 1; # number of octetc needed to represent the UTF-8 character
7635
7669
 
7636
7670
  str = str.to_s; # force :str to be a string
7637
-
7671
+
7638
7672
  str.each_byte do |char|
7639
7673
  if (bytes.length == 0) # get starting octect
7640
7674
  if (char <= 0x7F)
7641
7675
  unicode << char # use the character "as is" because is ASCII
7642
7676
  numbytes = 1
7643
7677
  elsif ((char >> 0x05) == 0x06) # 2 bytes character (0x06 = 110 BIN)
7644
- bytes << ((char - 0xC0) << 0x06)
7678
+ bytes << ((char - 0xC0) << 0x06)
7645
7679
  numbytes = 2
7646
7680
  elsif ((char >> 0x04) == 0x0E) # 3 bytes character (0x0E = 1110 BIN)
7647
- bytes << ((char - 0xE0) << 0x0C)
7681
+ bytes << ((char - 0xE0) << 0x0C)
7648
7682
  numbytes = 3
7649
7683
  elsif ((char >> 0x03) == 0x1E) # 4 bytes character (0x1E = 11110 BIN)
7650
7684
  bytes << ((char - 0xF0) << 0x12)
@@ -7687,7 +7721,7 @@ protected
7687
7721
  @cache_utf8_string_to_array[str] = unicode.dup
7688
7722
  return unicode;
7689
7723
  end
7690
-
7724
+
7691
7725
  #
7692
7726
  # Converts UTF-8 strings to UTF16-BE.
7693
7727
  # [@param string :str] string to process.
@@ -7768,26 +7802,26 @@ protected
7768
7802
  # * Based on: http://www.faqs.org/rfcs/rfc2781.html
7769
7803
  #
7770
7804
  # Encoding UTF-16:
7771
- #
7805
+ #
7772
7806
  # Encoding of a single character from an ISO 10646 character value to
7773
7807
  # UTF-16 proceeds as follows. Let U be the character number, no greater
7774
7808
  # than 0x10FFFF.
7775
- #
7809
+ #
7776
7810
  # 1) If U < 0x10000, encode U as a 16-bit unsigned integer and
7777
7811
  # terminate.
7778
- #
7812
+ #
7779
7813
  # 2) Let U' = U - 0x10000. Because U is less than or equal to 0x10FFFF,
7780
7814
  # U' must be less than or equal to 0xFFFFF. That is, U' can be
7781
7815
  # represented in 20 bits.
7782
- #
7816
+ #
7783
7817
  # 3) Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and
7784
7818
  # 0xDC00, respectively. These integers each have 10 bits free to
7785
7819
  # encode the character value, for a total of 20 bits.
7786
- #
7820
+ #
7787
7821
  # 4) Assign the 10 high-order bits of the 20-bit U' to the 10 low-order
7788
7822
  # bits of W1 and the 10 low-order bits of U' to the 10 low-order
7789
7823
  # bits of W2. Terminate.
7790
- #
7824
+ #
7791
7825
  # Graphically, steps 2 through 4 look like:
7792
7826
  # U' = yyyyyyyyyyxxxxxxxxxx
7793
7827
  # W1 = 110110yyyyyyyyyy
@@ -7824,10 +7858,10 @@ protected
7824
7858
  end
7825
7859
  return outstr;
7826
7860
  end
7827
-
7861
+
7828
7862
  # ====================================================
7829
7863
  public
7830
-
7864
+
7831
7865
  #
7832
7866
  # Set header font.
7833
7867
  # [@param array :font] font
@@ -7838,7 +7872,7 @@ public
7838
7872
  @header_font = font;
7839
7873
  end
7840
7874
  alias_method :set_header_font, :setHeaderFont
7841
-
7875
+
7842
7876
  def SetHeaderFont(font)
7843
7877
  warn "[DEPRECATION] 'SetHeaderFont' is deprecated. Please use 'set_header_font' instead."
7844
7878
  setHeaderFont(font)
@@ -7865,7 +7899,7 @@ public
7865
7899
  @footer_font = font;
7866
7900
  end
7867
7901
  alias_method :set_footer_font, :setFooterFont
7868
-
7902
+
7869
7903
  def SetFooterFont(font)
7870
7904
  warn "[DEPRECATION] 'SetFooterFont' is deprecated. Please use 'set_footer_font' instead."
7871
7905
  setFooterFont(font)
@@ -7913,7 +7947,7 @@ public
7913
7947
  return @buffer;
7914
7948
  end
7915
7949
  alias_method :get_pdf_data, :getPDFData
7916
-
7950
+
7917
7951
  def GetPDFData()
7918
7952
  warn "[DEPRECATION] 'GetPDFData' is deprecated. Please use 'get_pdf_data' instead."
7919
7953
  getPDFData()
@@ -7958,10 +7992,10 @@ public
7958
7992
  return ret
7959
7993
  end
7960
7994
  alias_method :add_html_link, :addHtmlLink
7961
-
7995
+
7962
7996
  #
7963
7997
  # Returns an associative array (keys: R,G,B) from an html color name or a six-digit or three-digit hexadecimal color representation (i.e. #3FE5AA or #7FF).
7964
- # [@param string :color] html color
7998
+ # [@param string :color] html color
7965
7999
  # [@return array] RGB color or empty array in case of error.
7966
8000
  # [@access public]
7967
8001
  #
@@ -7977,7 +8011,7 @@ public
7977
8011
  end
7978
8012
  returncolor = ActiveSupport::OrderedHash.new
7979
8013
  # RGB ARRAY
7980
- if color[0,3] == 'rgb'
8014
+ if color[0,3] == 'rgb'
7981
8015
  codes = color.sub(/^rgb\(/, '')
7982
8016
  codes = codes.gsub(')', '')
7983
8017
  returncolor = codes.split(',', 3)
@@ -7987,7 +8021,7 @@ public
7987
8021
  return returncolor
7988
8022
  end
7989
8023
  # CMYK ARRAY
7990
- if color[0,4] == 'cmyk'
8024
+ if color[0,4] == 'cmyk'
7991
8025
  codes = color.sub(/^cmyk\(/, '')
7992
8026
  codes = codes.gsub(')', '')
7993
8027
  returncolor[0] = returncolor[0].to_i
@@ -8028,7 +8062,7 @@ public
8028
8062
  return returncolor
8029
8063
  end
8030
8064
  alias_method :convert_html_color_to_dec, :convertHTMLColorToDec
8031
-
8065
+
8032
8066
  #
8033
8067
  # Converts pixels to Units.
8034
8068
  # [@param int] :px pixels
@@ -8040,7 +8074,7 @@ public
8040
8074
  return (px.to_f / (@img_scale * @k))
8041
8075
  end
8042
8076
  alias_method :pixels_to_units, :pixelsToUnits
8043
-
8077
+
8044
8078
  #
8045
8079
  # Reverse function for htmlentities.
8046
8080
  # Convert entities in UTF-8.
@@ -8073,7 +8107,7 @@ public
8073
8107
  return s
8074
8108
  #end
8075
8109
  #case @encryptdata['mode']
8076
- #when 0, 1: # 0: RC4 40 bit, 1: RC4 128 bit
8110
+ #when 0, 1: # 0: RC4 40 bit, 1: RC4 128 bit
8077
8111
  # s = _RC4(objectkey(n), s)
8078
8112
  #when 2: # AES 128 bit
8079
8113
  # s = _AES(objectkey(n), s)
@@ -8101,7 +8135,7 @@ public
8101
8135
  @transfmatrix[@transfmatrix_key] = []
8102
8136
  end
8103
8137
  alias_method :start_transform, :StartTransform
8104
-
8138
+
8105
8139
  #
8106
8140
  # Stops a 2D tranformation restoring previous graphic state.
8107
8141
  # This function must be called after scaling, mirroring, translation, rotation and skewing.
@@ -8119,7 +8153,7 @@ public
8119
8153
  @transfmrk[@page] = nil
8120
8154
  end
8121
8155
  alias_method :stop_transform, :StopTransform
8122
-
8156
+
8123
8157
  #
8124
8158
  # Rotate object.
8125
8159
  # [@param float :angle] angle in degrees for counter-clockwise rotation
@@ -8133,11 +8167,11 @@ public
8133
8167
  if (x == '')
8134
8168
  x = @x
8135
8169
  end
8136
-
8170
+
8137
8171
  if (y == '')
8138
8172
  y = @y
8139
8173
  end
8140
-
8174
+
8141
8175
  y = (@h - y) * @k
8142
8176
  x *= @k
8143
8177
 
@@ -8154,7 +8188,7 @@ public
8154
8188
  Transform(tm)
8155
8189
  end
8156
8190
  alias_method :rotate, :Rotate
8157
-
8191
+
8158
8192
  #
8159
8193
  # Apply graphic transformations.
8160
8194
  # [@param array :tm] transformation matrix
@@ -8381,7 +8415,7 @@ public
8381
8415
  out('S')
8382
8416
  end
8383
8417
  alias_method :line, :Line
8384
-
8418
+
8385
8419
  #
8386
8420
  # Draws a rectangle.
8387
8421
  # [@param float :x] Abscissa of upper-left corner (or upper-right corner for RTL language).
@@ -9044,7 +9078,7 @@ public
9044
9078
  # create string from array
9045
9079
  str = UTF8ArrSubString(ta)
9046
9080
  end
9047
-
9081
+
9048
9082
  # check if string contains arabic text
9049
9083
  str.force_encoding('ASCII-8BIT') if str.respond_to?(:force_encoding)
9050
9084
  if str =~ @@k_re_pattern_arabic
@@ -9057,10 +9091,10 @@ public
9057
9091
  unless forcertl or arabic or (str =~ @@k_re_pattern_rtl)
9058
9092
  return ta
9059
9093
  end
9060
-
9094
+
9061
9095
  # get number of chars
9062
9096
  numchars = ta.length
9063
-
9097
+
9064
9098
  if forcertl == 'R'
9065
9099
  pel = 1
9066
9100
  elsif forcertl == 'L'
@@ -9079,7 +9113,7 @@ public
9079
9113
  end
9080
9114
  end
9081
9115
  end
9082
-
9116
+
9083
9117
  # Current Embedding Level
9084
9118
  cel = pel
9085
9119
  # directional override status
@@ -9088,10 +9122,10 @@ public
9088
9122
  # start-of-level-run
9089
9123
  sor = (pel % 2 == 1) ? 'R' : 'L'
9090
9124
  eor = sor
9091
-
9125
+
9092
9126
  # Array of characters data
9093
9127
  chardata = []
9094
-
9128
+
9095
9129
  # X1. Begin by setting the current embedding level to the paragraph embedding level. Set the directional override status to neutral. Process each character iteratively, applying rules X2 through X9. Only embedding levels from 0 to 61 are valid in this phase.
9096
9130
  # In the resolution of levels in rules I1 and I2, the maximum embedding level of 62 can be reached.
9097
9131
  reg_KRP = /^(@@k_rle|@@k_lre|@@k_rlo|@@k_lro|@@k_pdf)$/
@@ -9175,16 +9209,16 @@ public
9175
9209
  end
9176
9210
  end
9177
9211
  end # end for each char
9178
-
9212
+
9179
9213
  # X8. All explicit directional embeddings and overrides are completely terminated at the end of each paragraph. Paragraph separators are not included in the embedding.
9180
9214
  # X9. Remove all RLE, LRE, RLO, LRO, PDF, and BN codes.
9181
9215
  # X10. The remaining rules are applied to each run of characters at the same level. For each run, determine the start-of-level-run (sor) and end-of-level-run (eor) type, either L or R. This depends on the higher of the two levels on either side of the boundary (at the start or end of the paragraph, the level of the 'other' run is the base embedding level). If the higher level is odd, the type is R; otherwise, it is L.
9182
-
9216
+
9183
9217
  # 3.3.3 Resolving Weak Types
9184
9218
  # Weak types are now resolved one level run at a time. At level run boundaries where the type of the character on the other side of the boundary is required, the type assigned to sor or eor is used.
9185
9219
  # Nonspacing marks are now resolved based on the previous characters.
9186
9220
  numchars = chardata.length
9187
-
9221
+
9188
9222
  # W1. Examine each nonspacing mark (NSM) in the level run, and change the type of the NSM to the type of the previous character. If the NSM is at the start of the level run, it will get the type of sor.
9189
9223
  prevlevel = -1 # track level changes
9190
9224
  levcount = 0 # counts consecutive chars at the same level
@@ -9203,7 +9237,7 @@ public
9203
9237
  end
9204
9238
  prevlevel = chardata[i][:level]
9205
9239
  end
9206
-
9240
+
9207
9241
  # W2. Search backward from each instance of a European number until the first strong type (R, L, AL, or sor) is found. If an AL is found, change the type of the European number to Arabic number.
9208
9242
  prevlevel = -1
9209
9243
  levcount = 0
@@ -9224,14 +9258,14 @@ public
9224
9258
  end
9225
9259
  prevlevel = chardata[i][:level]
9226
9260
  end
9227
-
9261
+
9228
9262
  # W3. Change all ALs to R.
9229
9263
  numchars.times do |i|
9230
9264
  if chardata[i][:type] == 'AL'
9231
9265
  chardata[i][:type] = 'R'
9232
9266
  end
9233
9267
  end
9234
-
9268
+
9235
9269
  # W4. A single European separator between two European numbers changes to a European number. A single common separator between two numbers of the same type changes to that type.
9236
9270
  prevlevel = -1
9237
9271
  levcount = 0
@@ -9252,7 +9286,7 @@ public
9252
9286
  end
9253
9287
  prevlevel = chardata[i][:level]
9254
9288
  end
9255
-
9289
+
9256
9290
  # W5. A sequence of European terminators adjacent to European numbers changes to all European numbers.
9257
9291
  prevlevel = -1
9258
9292
  levcount = 0
@@ -9280,7 +9314,7 @@ public
9280
9314
  end
9281
9315
  prevlevel = chardata[i][:level]
9282
9316
  end
9283
-
9317
+
9284
9318
  # W6. Otherwise, separators and terminators change to Other Neutral.
9285
9319
  prevlevel = -1
9286
9320
  levcount = 0
@@ -9296,7 +9330,7 @@ public
9296
9330
  end
9297
9331
  prevlevel = chardata[i][:level]
9298
9332
  end
9299
-
9333
+
9300
9334
  # W7. Search backward from each instance of a European number until the first strong type (R, L, or sor) is found. If an L is found, then change the type of the European number to L.
9301
9335
  prevlevel = -1
9302
9336
  levcount = 0
@@ -9317,7 +9351,7 @@ public
9317
9351
  end
9318
9352
  prevlevel = chardata[i][:level]
9319
9353
  end
9320
-
9354
+
9321
9355
  # N1. A sequence of neutrals takes the direction of the surrounding strong text if the text on both sides has the same direction. European and Arabic numbers act as if they were R in terms of their influence on neutrals. Start-of-level-run (sor) and end-of-level-run (eor) are used at level run boundaries.
9322
9356
  prevlevel = -1
9323
9357
  levcount = 0
@@ -9385,7 +9419,7 @@ public
9385
9419
  end
9386
9420
  prevlevel = chardata[i][:level]
9387
9421
  end
9388
-
9422
+
9389
9423
  # I1. For all characters with an even (left-to-right) embedding direction, those of type R go up one level and those of type AN or EN go up two levels.
9390
9424
  # I2. For all characters with an odd (right-to-left) embedding direction, those of type L, EN or AN go up one level.
9391
9425
  prevlevel = -1
@@ -9410,7 +9444,7 @@ public
9410
9444
  prevlevel = chardata[i][:level]
9411
9445
  maxlevel = [chardata[i][:level],maxlevel].max
9412
9446
  end
9413
-
9447
+
9414
9448
  # L1. On each line, reset the embedding level of the following characters to the paragraph embedding level:
9415
9449
  # 1. Segment separators,
9416
9450
  # 2. Paragraph separators,
@@ -9434,9 +9468,9 @@ public
9434
9468
  end
9435
9469
  end
9436
9470
  end
9437
-
9471
+
9438
9472
  # Arabic Shaping
9439
- # Cursively connected scripts, such as Arabic or Syriac, require the selection of positional character shapes that depend on adjacent characters. Shaping is logically applied after the Bidirectional Algorithm is used and is limited to characters within the same directional run.
9473
+ # Cursively connected scripts, such as Arabic or Syriac, require the selection of positional character shapes that depend on adjacent characters. Shaping is logically applied after the Bidirectional Algorithm is used and is limited to characters within the same directional run.
9440
9474
  if arabic
9441
9475
  endedletter = [1569,1570,1571,1572,1573,1575,1577,1583,1584,1585,1586,1608,1688]
9442
9476
  alfletter = [1570,1571,1573,1575]
@@ -9528,7 +9562,7 @@ public
9528
9562
  # Allah Word
9529
9563
  # mark characters to delete with false
9530
9564
  chardata2[i-2][:char] = false
9531
- chardata2[i-1][:char] = false
9565
+ chardata2[i-1][:char] = false
9532
9566
  chardata2[i][:char] = 65010
9533
9567
  else
9534
9568
  if (prevchar != false) and endedletter.include?(prevchar[:char])
@@ -9555,7 +9589,7 @@ public
9555
9589
  end # end if AL (Arabic Letter)
9556
9590
  end # end for each char
9557
9591
 
9558
- #
9592
+ #
9559
9593
  # Combining characters that can occur with Arabic Shadda (0651 HEX, 1617 DEC) are replaced.
9560
9594
  # Putting the combining mark and shadda in the same glyph allows us to avoid the two marks overlapping each other in an illegible manner.
9561
9595
  #
@@ -9582,7 +9616,7 @@ public
9582
9616
  laaletter = nil
9583
9617
  charAL = nil
9584
9618
  end
9585
-
9619
+
9586
9620
  # L2. From the highest level found in the text to the lowest odd level on each line, including intermediate levels not actually present in the text, reverse any contiguous sequence of characters that are at that level or higher.
9587
9621
  maxlevel.downto(1) do |j|
9588
9622
  ordarray = []
@@ -9613,16 +9647,16 @@ public
9613
9647
  end
9614
9648
  chardata = ordarray
9615
9649
  end
9616
-
9650
+
9617
9651
  ordarray = []
9618
9652
  numchars.times do |i|
9619
9653
  ordarray.push chardata[i][:char]
9620
9654
  end
9621
-
9655
+
9622
9656
  return ordarray
9623
9657
  end
9624
9658
  protected :utf8Bidi
9625
-
9659
+
9626
9660
  # END OF BIDIRECTIONAL TEXT SECTION -------------------
9627
9661
 
9628
9662
  #
@@ -9783,7 +9817,7 @@ public
9783
9817
  @alias_num_page = alias_num
9784
9818
  end
9785
9819
  alias_method :alias_num_page, :AliasNumPage
9786
-
9820
+
9787
9821
  #
9788
9822
  # Returns the string alias used for the page number.
9789
9823
  # If the current font is unicode type, the returned string is surrounded by additional curly braces.
@@ -10028,8 +10062,8 @@ public
10028
10062
  # [@access public]
10029
10063
  # [@since 3.0.014 (2008-06-04)]
10030
10064
  #
10031
- def setCellHeightRatio(h)
10032
- @cell_height_ratio = h
10065
+ def setCellHeightRatio(h)
10066
+ @cell_height_ratio = h
10033
10067
  end
10034
10068
  alias_method :set_cell_height_ratio, :setCellHeightRatio
10035
10069
 
@@ -10093,7 +10127,7 @@ public
10093
10127
  # * BleedBox
10094
10128
  # * TrimBox
10095
10129
  # * ArtBox
10096
- # * PrintScaling name (Optional; PDF 1.6) The page scaling option to be selected when a print dialog is displayed for this document. Valid values are:
10130
+ # * PrintScaling name (Optional; PDF 1.6) The page scaling option to be selected when a print dialog is displayed for this document. Valid values are:
10097
10131
  # * None, which indicates that the print dialog should reflect no page scaling
10098
10132
  # * AppDefault (default), which indicates that applications should use the current print scaling
10099
10133
  # * Duplex name (Optional; PDF 1.7) The paper handling option to use when printing the file from the print dialog. The following values are valid:
@@ -10183,7 +10217,7 @@ public
10183
10217
  @barcode = bc;
10184
10218
  end
10185
10219
  alias_method :set_barcode, :setBarcode
10186
-
10220
+
10187
10221
  def SetBarcode(bc="")
10188
10222
  warn "[DEPRECATION] 'SetBarcode' is deprecated. Please use 'set_barcode' instead."
10189
10223
  setBarcode(bc)
@@ -10199,7 +10233,7 @@ public
10199
10233
  return @barcode
10200
10234
  end
10201
10235
  alias_method :get_barcode, :getBarcode
10202
-
10236
+
10203
10237
  #
10204
10238
  # Print Barcode.
10205
10239
  # [@param int :x] x position in user units
@@ -10220,11 +10254,11 @@ public
10220
10254
  require(File.dirname(__FILE__) + "/barcode/c128aobject.rb");
10221
10255
  require(File.dirname(__FILE__) + "/barcode/c128bobject.rb");
10222
10256
  require(File.dirname(__FILE__) + "/barcode/c128cobject.rb");
10223
-
10257
+
10224
10258
  if (code.empty?)
10225
10259
  return;
10226
10260
  end
10227
-
10261
+
10228
10262
  if (style.empty?)
10229
10263
  style = BCS_ALIGN_LEFT;
10230
10264
  style |= BCS_IMAGE_PNG;
@@ -10236,11 +10270,11 @@ public
10236
10270
  end
10237
10271
  if (font.empty?) then font = BCD_DEFAULT_FONT; end
10238
10272
  if (xres.empty?) then xres = BCD_DEFAULT_XRES; end
10239
-
10273
+
10240
10274
  scale_factor = 1.5 * xres * @k;
10241
10275
  bc_w = (w * scale_factor).round #width in points
10242
10276
  bc_h = (h * scale_factor).round #height in points
10243
-
10277
+
10244
10278
  case (type.upcase)
10245
10279
  when "I25"
10246
10280
  obj = I25Object.new(bc_w, bc_h, style, code);
@@ -10253,10 +10287,10 @@ public
10253
10287
  when "C39"
10254
10288
  obj = C39Object.new(bc_w, bc_h, style, code);
10255
10289
  end
10256
-
10257
- obj.SetFont(font);
10290
+
10291
+ obj.SetFont(font);
10258
10292
  obj.DrawObject(xres);
10259
-
10293
+
10260
10294
  #use a temporary file....
10261
10295
  tmpName = tempnam(@@k_path_cache,'img');
10262
10296
  imagepng(obj.getImage(), tmpName);
@@ -10267,7 +10301,7 @@ public
10267
10301
  end
10268
10302
  alias_method :write_barcode, :writeBarcode
10269
10303
  =end
10270
-
10304
+
10271
10305
  #
10272
10306
  # Returns an array containing current margins:
10273
10307
  #
@@ -10301,7 +10335,7 @@ public
10301
10335
  # Returns an array containing original margins:
10302
10336
  # ret['left'] = left margin
10303
10337
  # ret['right'] = right margin
10304
- # [@return array] containing all margins measures
10338
+ # [@return array] containing all margins measures
10305
10339
  # [@access public]
10306
10340
  # [@since 4.0.012 (2008-07-24)]
10307
10341
  #
@@ -10824,7 +10858,7 @@ protected
10824
10858
  # store header rows on a new table
10825
10859
  if (dom[key]['value'] == 'tr') and (dom[(dom[key]['parent'])]['thead'] == true)
10826
10860
  if empty_string(dom[grandparent]['thead'])
10827
- if dom[grandparent]['attribute'].nil? or dom[grandparent]['attribute']['style'].nil?
10861
+ if dom[grandparent]['attribute'].nil? or dom[grandparent]['attribute']['style'].nil?
10828
10862
  dom[grandparent]['thead'] = a[dom[grandparent]['elkey']].dup
10829
10863
  else
10830
10864
  dom[grandparent]['thead'] = '<style>' + dom[grandparent]['value'] + ' {' + dom[grandparent]['attribute']['style'] + '}</style>' + a[dom[grandparent]['elkey']].dup
@@ -11219,7 +11253,7 @@ protected
11219
11253
  #
11220
11254
  def get_sever_url(url)
11221
11255
  if !empty_string(url) and (url[0, 1] == '/')
11222
- ''
11256
+ ''
11223
11257
  else
11224
11258
  url
11225
11259
  end
@@ -11285,6 +11319,9 @@ public
11285
11319
  alias_method :write_html_cell, :writeHTMLCell
11286
11320
 
11287
11321
  def sanitize_html(html)
11322
+ # Escape '<' character for not tag case.
11323
+ html = html.gsub(%r{(<+)([^/a-zA-Z])}){CGI.escapeHTML($1) + $2}.gsub(%r{</([^a-zA-Z])}){'&lt;/' + $1}
11324
+
11288
11325
  html = "%s" % sanitize(html, :tags=> %w(a b blockquote body br dd del div dl dt em font h1 h2 h3 h4 h5 h6 hr i img li ol p pre small span strong sub sup table td th thead tr tt u ins ul), :attributes => %w(cellspacing cellpadding bgcolor color value width height src size colspan rowspan style align border face href dir class id nobr stroke strokecolor fill nested tablehead))
11289
11326
  end
11290
11327
  protected :sanitize_html
@@ -11312,9 +11349,9 @@ public
11312
11349
  cell = false if cell == 0
11313
11350
  case fill
11314
11351
  when true
11315
- fill = 1
11352
+ fill = 1
11316
11353
  when false
11317
- fill = 0
11354
+ fill = 0
11318
11355
  end
11319
11356
 
11320
11357
  gvars = getGraphicVars()
@@ -11398,7 +11435,7 @@ public
11398
11435
  key = 0
11399
11436
  while key < maxel
11400
11437
  if dom[key]['tag'] and dom[key]['attribute'] and dom[key]['attribute']['pagebreak']
11401
- # check for pagebreak
11438
+ # check for pagebreak
11402
11439
  if (dom[key]['attribute']['pagebreak'] == 'true') or (dom[key]['attribute']['pagebreak'] == 'left') or (dom[key]['attribute']['pagebreak'] == 'right')
11403
11440
  # add a page (or trig AcceptPageBreak() for multicolumn mode)
11404
11441
  checkPageBreak(@page_break_trigger + 1)
@@ -11475,7 +11512,7 @@ public
11475
11512
  rollbackTransaction(true)
11476
11513
  # restore previous values
11477
11514
  this_method_vars.each {|vkey , vval|
11478
- eval("#{vkey} = vval")
11515
+ eval("#{vkey} = vval")
11479
11516
  }
11480
11517
  # add a page (or trig AcceptPageBreak() for multicolumn mode)
11481
11518
  pre_y = @y
@@ -11502,13 +11539,13 @@ public
11502
11539
  dom[key]['align'] = @rtl ? 'R' : 'L'
11503
11540
  end
11504
11541
  # vertically align image in line
11505
- if !@newline and (dom[key]['value'] == 'img') and !dom[key]['attribute']['height'].nil? and (dom[key]['attribute']['height'].to_i > 0)
11542
+ if !@newline and (dom[key]['value'] == 'img') and dom[key]['height'] and (dom[key]['height'].to_i > 0)
11506
11543
  # get image height
11507
- imgh = getHTMLUnitToUnits(dom[key]['attribute']['height'], @lasth, 'px')
11544
+ imgh = getHTMLUnitToUnits(dom[key]['height'], @lasth, 'px')
11508
11545
  # check for automatic line break
11509
11546
  autolinebreak = false
11510
- if dom[key]['attribute']['width'] and (dom[key]['attribute']['width'].to_i > 0)
11511
- imgw = getHTMLUnitToUnits(dom[key]['attribute']['width'], 1, 'px', false)
11547
+ if dom[key]['width'] and (dom[key]['width'].to_i > 0)
11548
+ imgw = getHTMLUnitToUnits(dom[key]['width'], 1, 'px', false)
11512
11549
  if (@rtl and (@x - imgw < @l_margin + @c_margin)) or (!@rtl and (@x + imgw > @w - @r_margin - @c_margin))
11513
11550
  # add automatic line break
11514
11551
  autolinebreak = true
@@ -11645,7 +11682,7 @@ public
11645
11682
  end
11646
11683
  # set text rendering mode
11647
11684
  textstroke = !dom[key]['stroke'].nil? ? dom[key]['stroke'] : @textstrokewidth
11648
- textfill = !dom[key]['fill'].nil? ? dom[key]['fill'] : ((@textrendermode % 2) == 0)
11685
+ textfill = !dom[key]['fill'].nil? ? dom[key]['fill'] : ((@textrendermode % 2) == 0)
11649
11686
  textclip = !dom[key]['clip'].nil? ? dom[key]['clip'] : (@textrendermode > 3)
11650
11687
  setTextRenderingMode(textstroke, textfill, textclip)
11651
11688
  if (plalign == 'J') and dom[key]['block']
@@ -11809,7 +11846,7 @@ public
11809
11846
  # check if we are inside a string section '[( ... )]'
11810
11847
  stroffset = pmid.index('[(', offset)
11811
11848
  if (stroffset != nil) and (stroffset <= pmid_offset)
11812
- # set offset to the end of string section
11849
+ # set offset to the end of string section
11813
11850
  offset = pmid.index(')]', stroffset)
11814
11851
  while (offset != nil) and (pmid[offset - 1, 1] == '\\')
11815
11852
  offset = pmid.index(')]', offset + 1)
@@ -12012,7 +12049,7 @@ public
12012
12049
  opentagpos = nil
12013
12050
  end
12014
12051
  if dom[key]['tag']
12015
- if dom[key]['opening']
12052
+ if dom[key]['opening']
12016
12053
  # get text indentation (if any)
12017
12054
  if dom[key]['text-indent'] and dom[key]['block']
12018
12055
  @textindent = dom[key]['text-indent']
@@ -12180,7 +12217,7 @@ public
12180
12217
  # account for row-spanned cells
12181
12218
  dom[table_el]['rowspans'][trsid - 1]['endx'] = @x
12182
12219
  dom[table_el]['rowspans'][trsid - 1]['endy'] = @y
12183
- dom[table_el]['rowspans'][trsid - 1]['endpage'] = @page
12220
+ dom[table_el]['rowspans'][trsid - 1]['endpage'] = @page
12184
12221
  end
12185
12222
  if !dom[table_el]['rowspans'].nil?
12186
12223
  # update endy and endpage on rowspanned cells
@@ -12337,7 +12374,7 @@ public
12337
12374
  rollbackTransaction(true)
12338
12375
  # restore previous values
12339
12376
  this_method_vars.each {|vkey , vval|
12340
- eval("#{vkey} = vval")
12377
+ eval("#{vkey} = vval")
12341
12378
  }
12342
12379
  # add a page (or trig AcceptPageBreak() for multicolumn mode)
12343
12380
  pre_y = @y
@@ -12462,7 +12499,7 @@ public
12462
12499
 
12463
12500
  #
12464
12501
  # Process opening tags.
12465
- # [@param array :dom] html dom array
12502
+ # [@param array :dom] html dom array
12466
12503
  # [@param int :key] current element id
12467
12504
  # [@param boolean :cell] if true add the default c_margin space to each new line (default false).
12468
12505
  # [@access protected]
@@ -12568,8 +12605,8 @@ public
12568
12605
  if cell
12569
12606
  wtmp -= 2 * @c_margin
12570
12607
  end
12571
- if !tag['attribute']['width'].nil? and (tag['attribute']['width'] != '')
12572
- hrWidth = getHTMLUnitToUnits(tag['attribute']['width'], wtmp, 'px')
12608
+ if tag['width'] and (tag['width'] != '')
12609
+ hrWidth = getHTMLUnitToUnits(tag['width'], wtmp, 'px')
12573
12610
  else
12574
12611
  hrWidth = wtmp
12575
12612
  end
@@ -12598,11 +12635,11 @@ public
12598
12635
  # tag['attribute']['src'] = CGI.escape(tag['attribute']['src'])
12599
12636
  type = getImageFileType(tag['attribute']['src'])
12600
12637
  tag['attribute']['src'] = get_image_filename(tag['attribute']['src'])
12601
- if tag['attribute']['width'].nil?
12602
- tag['attribute']['width'] = 0
12638
+ if tag['width'].nil?
12639
+ tag['width'] = 0
12603
12640
  end
12604
- if tag['attribute']['height'].nil?
12605
- tag['attribute']['height'] = 0
12641
+ if tag['height'].nil?
12642
+ tag['height'] = 0
12606
12643
  end
12607
12644
  #if tag['attribute']['align'].nil?
12608
12645
  # the only alignment supported is "bottom"
@@ -12654,12 +12691,12 @@ public
12654
12691
  end
12655
12692
  end
12656
12693
  iw = 0
12657
- if !tag['attribute']['width'].nil?
12658
- iw = getHTMLUnitToUnits(tag['attribute']['width'], 1, 'px', false)
12694
+ if tag['width']
12695
+ iw = getHTMLUnitToUnits(tag['width'], 1, 'px', false)
12659
12696
  end
12660
12697
  ih = 0
12661
- if !tag['attribute']['height'].nil?
12662
- ih = getHTMLUnitToUnits(tag['attribute']['height'], 1, 'px', false)
12698
+ if tag['height']
12699
+ ih = getHTMLUnitToUnits(tag['height'], 1, 'px', false)
12663
12700
  end
12664
12701
 
12665
12702
  # store original margin values
@@ -12730,7 +12767,7 @@ public
12730
12767
  end
12731
12768
  if !tag['attribute']['start'].nil?
12732
12769
  @listcount[@listnum] = tag['attribute']['start'].to_i - 1
12733
- else
12770
+ else
12734
12771
  @listcount[@listnum] = 0
12735
12772
  end
12736
12773
  if @rtl
@@ -12802,7 +12839,7 @@ public
12802
12839
 
12803
12840
  if dom[key]['self'] and dom[key]['attribute']['pagebreakafter']
12804
12841
  pba = dom[key]['attribute']['pagebreakafter']
12805
- # check for pagebreak
12842
+ # check for pagebreak
12806
12843
  if (pba == 'true') or (pba == 'left') or (pba == 'right')
12807
12844
  # add a page (or trig AcceptPageBreak() for multicolumn mode)
12808
12845
  checkPageBreak(@page_break_trigger + 1)
@@ -12815,10 +12852,10 @@ public
12815
12852
  dom
12816
12853
  end
12817
12854
  protected :openHTMLTagHandler
12818
-
12855
+
12819
12856
  #
12820
12857
  # Process closing tags.
12821
- # [@param array :dom] html dom array
12858
+ # [@param array :dom] html dom array
12822
12859
  # [@param int :key] current element id
12823
12860
  # [@param boolean :cell] if true add the default c_margin space to each new line (default false).
12824
12861
  # [@param int :maxbottomliney] maximum y value of current line
@@ -13050,7 +13087,7 @@ public
13050
13087
  setPageBuffer(@page, pstart + ccode + "\n" + pend)
13051
13088
  end
13052
13089
  end
13053
- }
13090
+ }
13054
13091
  if !table_el['attribute']['cellspacing'].nil?
13055
13092
  cellspacing = getHTMLUnitToUnits(table_el['attribute']['cellspacing'], 1, 'px')
13056
13093
  @y += cellspacing
@@ -13157,7 +13194,7 @@ public
13157
13194
  end
13158
13195
  if dom[(dom[key]['parent'])]['attribute']['pagebreakafter']
13159
13196
  pba = dom[(dom[key]['parent'])]['attribute']['pagebreakafter']
13160
- # check for pagebreak
13197
+ # check for pagebreak
13161
13198
  if (pba == 'true') or (pba == 'left') or (pba == 'right')
13162
13199
  # add a page (or trig AcceptPageBreak() for multicolumn mode)
13163
13200
  checkPageBreak(@page_break_trigger + 1)
@@ -13171,7 +13208,7 @@ public
13171
13208
  dom
13172
13209
  end
13173
13210
  protected :closeHTMLTagHandler
13174
-
13211
+
13175
13212
  #
13176
13213
  # Add vertical spaces if needed.
13177
13214
  # [@param string :hbz] Distance between current y and line bottom.
@@ -13393,7 +13430,7 @@ protected
13393
13430
  color = @fgcolor
13394
13431
  width = 0
13395
13432
  textitem = ''
13396
- tmpx = @x
13433
+ tmpx = @x
13397
13434
  lspace = GetStringWidth(' ')
13398
13435
  if listtype == '!'
13399
13436
  # set default list type for unordered list
@@ -13734,7 +13771,7 @@ protected
13734
13771
  @images[image][key] = data
13735
13772
  end
13736
13773
  end
13737
-
13774
+
13738
13775
  #
13739
13776
  # Get image buffer content.
13740
13777
  # [@param string :image] image key
@@ -14270,7 +14307,7 @@ public
14270
14307
  @outlines.each_with_index do |outline, key|
14271
14308
  if empty_string(page)
14272
14309
  pagenum = outline[:p].to_s
14273
- else
14310
+ else
14274
14311
  # placemark to be replaced with the correct number
14275
14312
  pagenum = '{#' + outline[:p].to_s + '}'
14276
14313
  if (@current_font['type'] == 'TrueTypeUnicode') or (@current_font['type'] == 'cidfont0')
@@ -14321,7 +14358,7 @@ public
14321
14358
  sdiffu = ku.length - ns.length
14322
14359
  sfill = ' ' * sdiff
14323
14360
  sfillu = ' ' * sdiffu
14324
- if @rtl
14361
+ if @rtl
14325
14362
  ns = ns + sfill
14326
14363
  nu = nu + sfillu
14327
14364
  else
@@ -14460,7 +14497,7 @@ public
14460
14497
  # [@param string :haystack] The string to search in.
14461
14498
  # [@param string :needle] substring to search.
14462
14499
  # [@param int :offset] May be specified to begin searching an arbitrary number of characters into the string.
14463
- # [@return] Returns the position where the needle exists. Returns FALSE if the needle was not found.
14500
+ # [@return] Returns the position where the needle exists. Returns FALSE if the needle was not found.
14464
14501
  # [@access public]
14465
14502
  # [@since 4.8.038 (2010-03-13)]
14466
14503
  #
@@ -14594,7 +14631,7 @@ public
14594
14631
  # -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
14595
14632
  end # END OF RBPDF CLASS
14596
14633
 
14597
- #TODO 2007-05-25 (EJM) Level=0 -
14634
+ #TODO 2007-05-25 (EJM) Level=0 -
14598
14635
  #Handle special IE contype request
14599
14636
  # if (!_SERVER['HTTP_USER_AGENT'].nil? and (_SERVER['HTTP_USER_AGENT']=='contype'))
14600
14637
  # header('Content-Type: application/pdf');