rbpdf 1.21.0 → 1.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +20 -12
- data/README.md +1 -1
- data/lib/core/mini_magick.rb +7 -3
- data/lib/core/rmagick.rb +6 -2
- data/lib/rbpdf/version.rb +1 -1
- data/lib/rbpdf.rb +112 -91
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fe46482c5272d1a1e3c050c4c421648ba584ddf21225655fbce7f86309050e8
|
4
|
+
data.tar.gz: 504808a1ddc2e1b0720bd8d1b0ce2960ef598ae808ce1af6173502e537a0ce4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34cb1673c7bb205ff539e8f8f9bf7b2b90ef2e0dc0bf0cd5cbea47dff4d4cb6ac0287f74001fe5418506b53d8dac93aaa5438018ab015a308991b31916f19dbe
|
7
|
+
data.tar.gz: 667285f30d8d889877a63bf23e897ebd2f2e7929392eb48b135994ff678c331cfb90adae6682aaedbd2b798ef64e187ce4931d34182b32235cb3acf6101c21d8
|
data/CHANGELOG
CHANGED
@@ -1,16 +1,24 @@
|
|
1
|
+
1.21.1 2023-03-20
|
2
|
+
- Changed version description of PDF PRODUCER. (#83)
|
3
|
+
- fix isValidCSSSelectorForTag method. (#82)
|
4
|
+
- Improved compatibility with ImageMagick 7.1.1-0 and later when using mini_magick. (#81)
|
5
|
+
- Fixed parsepng method to support transparent GIF and PNG tRNS transparency. (#80)
|
6
|
+
- ImageMagick7 support in RMagick 5.2.0. (#79)
|
7
|
+
- Add support WebP image. (#77)
|
8
|
+
|
1
9
|
1.21.0 2023-02-13
|
2
|
-
- Support for Ruby 3.0.0, 3.1.0, 3.2.0. (Drop support for Ruby 2.2 and earlier.) #66
|
3
|
-
- Support Rails 6 and Rails 7. (Drop support for Rails 3.x, 4.x) #66, #72
|
4
|
-
- Fix RMagick 5.0 compatible. #66
|
5
|
-
- Infinite loop has been resolved. #68, #74
|
6
|
-
- Fixed a bug that caused the x position to shift when an <img> tag was behind a <li> tag in HTML. #74
|
7
|
-
- fix: Incorrect characters when copying out of a generated PDF with Unicode fonts. #71
|
8
|
-
- Suppresses output for Circle(), Ellipse(), PieSector(), and PieSectorXY() when the radius is 0. #67
|
9
|
-
- Don't change an object while iterating over it #59 (by thegcat)
|
10
|
-
- fix : bidi bug #56 (by ahorek)
|
11
|
-
- Avoid rdoc stack level too deep (SystemStackError) in gem install. #76
|
12
|
-
- PDF example output option OUTPUT=true added #70
|
13
|
-
- Make the image file path acquisition process extensible #58 (by yui-har)
|
10
|
+
- Support for Ruby 3.0.0, 3.1.0, 3.2.0. (Drop support for Ruby 2.2 and earlier.) (#66)
|
11
|
+
- Support Rails 6 and Rails 7. (Drop support for Rails 3.x, 4.x) (#66, #72)
|
12
|
+
- Fix RMagick 5.0 compatible. (#66)
|
13
|
+
- Infinite loop has been resolved. (#68, #74)
|
14
|
+
- Fixed a bug that caused the x position to shift when an <img> tag was behind a <li> tag in HTML. (#74)
|
15
|
+
- fix: Incorrect characters when copying out of a generated PDF with Unicode fonts. (#71)
|
16
|
+
- Suppresses output for Circle(), Ellipse(), PieSector(), and PieSectorXY() when the radius is 0. (#67)
|
17
|
+
- Don't change an object while iterating over it (#59) (by thegcat)
|
18
|
+
- fix : bidi bug (#56) (by ahorek)
|
19
|
+
- Avoid rdoc stack level too deep (SystemStackError) in gem install. (#76)
|
20
|
+
- PDF example output option OUTPUT=true added (#70)
|
21
|
+
- Make the image file path acquisition process extensible (#58) (by yui-har)
|
14
22
|
|
15
23
|
1.20.1 2019-08-21
|
16
24
|
- fix license warning. (by pavel)
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ A template plugin allowing the inclusion of ERB-enabled RBPDF template files.
|
|
16
16
|
* CSS minimum support.
|
17
17
|
* Image
|
18
18
|
- 8bit PNG image support without MiniMagick/RMagick library.
|
19
|
-
- PNG(with alpha channel)/JPEG/GIF image support. (use MiniMagick or RMagick library)
|
19
|
+
- PNG(with alpha channel)/JPEG/GIF/WebP image support. (use MiniMagick or RMagick library)
|
20
20
|
|
21
21
|
|
22
22
|
##
|
data/lib/core/mini_magick.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: ASCII-8BIT
|
1
2
|
# The MIT License
|
2
3
|
#
|
3
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -55,6 +56,7 @@ module Rbpdf
|
|
55
56
|
width = image.width
|
56
57
|
height = image.height
|
57
58
|
|
59
|
+
out['mime'] = image.mime_type
|
58
60
|
out[0] = width
|
59
61
|
out[1] = height
|
60
62
|
|
@@ -67,17 +69,19 @@ module Rbpdf
|
|
67
69
|
out[2] = "JPEG"
|
68
70
|
when "image/png"
|
69
71
|
out[2] = "PNG"
|
70
|
-
when "
|
72
|
+
when "image/webp", "image/x-webp"
|
73
|
+
out[2] = "WEBP"
|
74
|
+
out['mime'] = "image/webp"
|
75
|
+
when "image/vnd.wap.wbmp"
|
71
76
|
out[2] = "WBMP"
|
72
77
|
when "image/x-xpixmap"
|
73
78
|
out[2] = "XPM"
|
74
79
|
end
|
75
80
|
out[3] = "height=\"#{height}\" width=\"#{width}\""
|
76
|
-
out['mime'] = image.mime_type
|
77
81
|
|
78
82
|
# This needs work to cover more situations
|
79
83
|
# I can't see how to just list the number of channels with ImageMagick / mini_magick
|
80
|
-
case image["%[channels]"].downcase
|
84
|
+
case image["%[channels]"].downcase.split.first
|
81
85
|
when 'cmyk'
|
82
86
|
out['channels'] = 4
|
83
87
|
when 'rgb', 'rgba', 'srgb', 'srgba' # Mac OS X : sRGB
|
data/lib/core/rmagick.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: ASCII-8BIT
|
1
2
|
# The MIT License
|
2
3
|
#
|
3
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -55,6 +56,7 @@ module Rbpdf
|
|
55
56
|
|
56
57
|
width = image.columns
|
57
58
|
height = image.rows
|
59
|
+
out['mime'] = image.mime_type
|
58
60
|
out[0] = width
|
59
61
|
out[1] = height
|
60
62
|
|
@@ -67,13 +69,15 @@ module Rbpdf
|
|
67
69
|
out[2] = "JPEG"
|
68
70
|
when "image/png"
|
69
71
|
out[2] = "PNG"
|
70
|
-
when "
|
72
|
+
when "image/webp", "image/x-webp"
|
73
|
+
out[2] = "WEBP"
|
74
|
+
out['mime'] = "image/webp"
|
75
|
+
when "image/vnd.wap.wbmp"
|
71
76
|
out[2] = "WBMP"
|
72
77
|
when "image/x-xpixmap"
|
73
78
|
out[2] = "XPM"
|
74
79
|
end
|
75
80
|
out[3] = "height=\"#{height}\" width=\"#{width}\""
|
76
|
-
out['mime'] = image.mime_type
|
77
81
|
|
78
82
|
# This needs work to cover more situations
|
79
83
|
# I can't see how to just list the number of channels with ImageMagick / rmagick
|
data/lib/rbpdf/version.rb
CHANGED
data/lib/rbpdf.rb
CHANGED
@@ -89,7 +89,7 @@ require 'net/http'
|
|
89
89
|
#
|
90
90
|
|
91
91
|
|
92
|
-
PDF_PRODUCER =
|
92
|
+
PDF_PRODUCER = "RBPDF #{Rbpdf::VERSION}"
|
93
93
|
|
94
94
|
# == This is a Ruby class for generating PDF files on-the-fly without requiring external extensions.
|
95
95
|
# * This class is a Ruby port of the TCPDF class by Nicola Asuni (http://www.tcpdf.org).
|
@@ -4790,7 +4790,7 @@ class RBPDF
|
|
4790
4790
|
# * explicit width and height (expressed in user unit)
|
4791
4791
|
# * one explicit dimension, the other being calculated automatically in order to keep the original proportions
|
4792
4792
|
# * no explicit dimension, in which case the image is put at 72 dpi
|
4793
|
-
# Supported formats are PNG images whitout RMagick/MiniMagick library and JPEG and GIF images supported by RMagick/MiniMagick.
|
4793
|
+
# Supported formats are PNG images whitout RMagick/MiniMagick library and JPEG and GIF and WebP images supported by RMagick/MiniMagick.
|
4794
4794
|
# For JPEG, all flavors are allowed:
|
4795
4795
|
# * gray scales
|
4796
4796
|
# * true colors (24 bits)
|
@@ -4808,7 +4808,7 @@ class RBPDF
|
|
4808
4808
|
# [@param float :y] Ordinate of the upper-left corner.
|
4809
4809
|
# [@param float :w] Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
|
4810
4810
|
# [@param float :h] Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
|
4811
|
-
# [@param string :type] Image format. Possible values are (case insensitive): JPG, JPEG, PNG. If not specified, the type is inferred from the file extension.
|
4811
|
+
# [@param string :type] Image format. Possible values are (case insensitive): JPG, JPEG, PNG, GIF, WebP. If not specified, the type is inferred from the file extension.
|
4812
4812
|
# [@param mixed :link] URL or identifier returned by AddLink().
|
4813
4813
|
# [@param string :align]
|
4814
4814
|
# Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
|
@@ -4974,12 +4974,19 @@ class RBPDF
|
|
4974
4974
|
|
4975
4975
|
info = false
|
4976
4976
|
if !resize
|
4977
|
-
|
4977
|
+
case type
|
4978
|
+
when 'jpeg'
|
4978
4979
|
info=parsejpeg(file)
|
4979
|
-
|
4980
|
-
info=parsepng(file)
|
4981
|
-
|
4982
|
-
tmpFile = imageToPNG(file)
|
4980
|
+
when 'png'
|
4981
|
+
info=parsepng(file)
|
4982
|
+
when 'webp'
|
4983
|
+
tmpFile = imageToPNG(file, false)
|
4984
|
+
if tmpFile != false
|
4985
|
+
info=parsepng(tmpFile.path)
|
4986
|
+
tmpFile.close(true)
|
4987
|
+
end
|
4988
|
+
when 'gif'
|
4989
|
+
tmpFile = imageToPNG(file, false)
|
4983
4990
|
if tmpFile != false
|
4984
4991
|
info=parsepng(tmpFile.path)
|
4985
4992
|
tmpFile.close(true)
|
@@ -4992,6 +4999,7 @@ class RBPDF
|
|
4992
4999
|
end
|
4993
5000
|
info=send(mtd, file);
|
4994
5001
|
end
|
5002
|
+
|
4995
5003
|
if info == 'pngalpha' and ismask == false and (Object.const_defined?(:MiniMagick) or Object.const_defined?(:Magick))
|
4996
5004
|
info = ImagePngAlpha(file, x, y, w, h, 'PNG', link, align, resize, dpi, palign)
|
4997
5005
|
if false != info
|
@@ -5156,29 +5164,38 @@ class RBPDF
|
|
5156
5164
|
end
|
5157
5165
|
protected :parsejpeg
|
5158
5166
|
|
5159
|
-
def imageToPNG(file)
|
5167
|
+
def imageToPNG(file, delete_alpha=true)
|
5160
5168
|
if Object.const_defined?(:MiniMagick)
|
5161
5169
|
# MiniMagick library
|
5162
5170
|
|
5163
5171
|
img = MiniMagick::Image.open(file)
|
5164
|
-
img.format 'png'
|
5165
|
-
if
|
5166
|
-
img.
|
5167
|
-
|
5168
|
-
|
5169
|
-
|
5170
|
-
|
5172
|
+
img.format 'png'
|
5173
|
+
if delete_alpha
|
5174
|
+
if ['rgba', 'srgba', 'graya'].include?(img["%[channels]"].downcase.split.first)
|
5175
|
+
img.combine_options do |mogrify|
|
5176
|
+
mogrify.alpha 'off'
|
5177
|
+
end
|
5178
|
+
if ['rgba', 'srgba', 'graya'].include?(img["%[channels]"].downcase.split.first)
|
5179
|
+
return false
|
5180
|
+
end
|
5171
5181
|
end
|
5172
5182
|
end
|
5173
5183
|
elsif Object.const_defined?(:Magick)
|
5174
5184
|
# RMagick library
|
5175
5185
|
|
5176
5186
|
img = Magick::ImageList.new(file)
|
5177
|
-
img.format = '
|
5178
|
-
if
|
5179
|
-
img.alpha Magick::DeactivateAlphaChannel # PNG alpha channel delete
|
5187
|
+
img.format = 'png'
|
5188
|
+
if delete_alpha
|
5180
5189
|
if img.alpha?
|
5181
|
-
|
5190
|
+
# PNG alpha channel delete
|
5191
|
+
if Magick.const_defined?(:OffAlphaChannel) # RMagick 5.2.0 and later
|
5192
|
+
img.alpha Magick::OffAlphaChannel
|
5193
|
+
else # RMagick 5.1.0 and before for ImageMagick 6.x
|
5194
|
+
img.alpha Magick::DeactivateAlphaChannel
|
5195
|
+
end
|
5196
|
+
if img.alpha?
|
5197
|
+
return false
|
5198
|
+
end
|
5182
5199
|
end
|
5183
5200
|
end
|
5184
5201
|
else
|
@@ -5199,45 +5216,45 @@ class RBPDF
|
|
5199
5216
|
# [@access protected]
|
5200
5217
|
#
|
5201
5218
|
def parsepng(file)
|
5202
|
-
f=open(file,'rb')
|
5203
|
-
#Check signature
|
5204
|
-
if
|
5205
|
-
Error('Not a PNG file: ' + file)
|
5206
|
-
end
|
5207
|
-
#Read header chunk
|
5208
|
-
f.read(4)
|
5209
|
-
if
|
5210
|
-
Error('Incorrect PNG file: ' + file)
|
5211
|
-
end
|
5212
|
-
w=freadint(f)
|
5213
|
-
h=freadint(f)
|
5214
|
-
bpc=f.read(1).unpack('C')[0]
|
5215
|
-
|
5216
|
-
ct
|
5217
|
-
|
5218
|
-
colspace='DeviceGray'
|
5219
|
-
|
5220
|
-
colspace='DeviceRGB'
|
5221
|
-
|
5222
|
-
colspace='Indexed'
|
5219
|
+
f = open(file,'rb')
|
5220
|
+
# Check signature
|
5221
|
+
if f.read(8) != 137.chr + 'PNG' + 13.chr + 10.chr + 26.chr + 10.chr
|
5222
|
+
Error('Not a PNG file: ' + file)
|
5223
|
+
end
|
5224
|
+
# Read header chunk
|
5225
|
+
f.read(4)
|
5226
|
+
if f.read(4) != 'IHDR'
|
5227
|
+
Error('Incorrect PNG file: ' + file)
|
5228
|
+
end
|
5229
|
+
w = freadint(f)
|
5230
|
+
h = freadint(f)
|
5231
|
+
bpc = f.read(1).unpack('C')[0]
|
5232
|
+
ct = f.read(1).unpack('C')[0]
|
5233
|
+
case ct
|
5234
|
+
when 0
|
5235
|
+
colspace = 'DeviceGray'
|
5236
|
+
when 2
|
5237
|
+
colspace = 'DeviceRGB'
|
5238
|
+
when 3
|
5239
|
+
colspace = 'Indexed'
|
5223
5240
|
else
|
5224
5241
|
if Object.const_defined?(:MiniMagick) or Object.const_defined?(:Magick)
|
5225
5242
|
# alpha channel
|
5226
5243
|
return 'pngalpha'
|
5227
5244
|
else
|
5228
|
-
Error('No RMagick/MiniMagick : Alpha channel not supported: ' + file)
|
5245
|
+
Error('No RMagick/MiniMagick : Alpha channel not supported: ' + file)
|
5229
5246
|
end
|
5230
5247
|
end
|
5231
|
-
if
|
5248
|
+
if f.read(1).unpack('C')[0] != 0
|
5232
5249
|
# Error('Unknown compression method: ' + file)
|
5233
5250
|
return false
|
5234
5251
|
end
|
5235
|
-
if
|
5252
|
+
if f.read(1).unpack('C')[0] != 0
|
5236
5253
|
# Error('Unknown filter method: ' + file)
|
5237
5254
|
return false
|
5238
5255
|
end
|
5239
5256
|
|
5240
|
-
if
|
5257
|
+
if bpc > 8
|
5241
5258
|
if Object.const_defined?(:MiniMagick) or Object.const_defined?(:Magick)
|
5242
5259
|
return false
|
5243
5260
|
else
|
@@ -5245,48 +5262,50 @@ class RBPDF
|
|
5245
5262
|
end
|
5246
5263
|
end
|
5247
5264
|
|
5248
|
-
if
|
5265
|
+
if f.read(1).unpack('C')[0] != 0
|
5249
5266
|
# Error('Interlacing not supported: ' + file)
|
5250
5267
|
return false
|
5251
5268
|
end
|
5252
|
-
f.read(4)
|
5253
|
-
parms='/DecodeParms <</Predictor 15 /Colors ' + (ct==2 ? 3 : 1).to_s + ' /BitsPerComponent ' + bpc.to_s + ' /Columns ' + w.to_s + '>>'
|
5254
|
-
#Scan chunks looking for palette, transparency and image data
|
5255
|
-
pal=''
|
5256
|
-
trns=''
|
5257
|
-
data=''
|
5269
|
+
f.read(4)
|
5270
|
+
parms='/DecodeParms <</Predictor 15 /Colors ' + (ct == 2 ? 3 : 1).to_s + ' /BitsPerComponent ' + bpc.to_s + ' /Columns ' + w.to_s + '>>'
|
5271
|
+
# Scan chunks looking for palette, transparency and image data
|
5272
|
+
pal = ''
|
5273
|
+
trns = ''
|
5274
|
+
data = ''
|
5258
5275
|
begin
|
5259
|
-
n=freadint(f)
|
5260
|
-
type=f.read(4)
|
5261
|
-
|
5262
|
-
|
5263
|
-
|
5264
|
-
f.read(
|
5265
|
-
|
5266
|
-
|
5267
|
-
|
5268
|
-
|
5269
|
-
|
5270
|
-
|
5271
|
-
trns = t[
|
5272
|
-
|
5273
|
-
|
5274
|
-
|
5275
|
-
|
5276
|
-
|
5277
|
-
|
5278
|
-
|
5279
|
-
|
5280
|
-
|
5281
|
-
|
5282
|
-
|
5283
|
-
|
5284
|
-
|
5276
|
+
n = freadint(f)
|
5277
|
+
type = f.read(4)
|
5278
|
+
case type
|
5279
|
+
when 'PLTE'
|
5280
|
+
# Read palette
|
5281
|
+
pal = f.read(n)
|
5282
|
+
f.read(4)
|
5283
|
+
when 'tRNS'
|
5284
|
+
# Read transparency info
|
5285
|
+
t = f.read(n)
|
5286
|
+
case ct
|
5287
|
+
when 0 # DeviceGray
|
5288
|
+
trns = [t[1].unpack('C')[0]]
|
5289
|
+
when 2 # DeviceRGB
|
5290
|
+
trns = [t[1].unpack('C')[0], t[3].unpack('C')[0], t[5].unpack('C')[0]]
|
5291
|
+
else # Indexed
|
5292
|
+
trns = []
|
5293
|
+
n.times do |i|
|
5294
|
+
trns << t[i].unpack('C')[0]
|
5295
|
+
end
|
5296
|
+
end
|
5297
|
+
f.read(4)
|
5298
|
+
when 'IDAT'
|
5299
|
+
# Read image data block
|
5300
|
+
data << f.read(n)
|
5301
|
+
f.read(4)
|
5302
|
+
when 'IEND'
|
5303
|
+
break
|
5285
5304
|
else
|
5286
|
-
f.read(
|
5305
|
+
f.read(n + 4)
|
5287
5306
|
end
|
5288
5307
|
end while(n)
|
5289
|
-
if (colspace=='Indexed' and pal.empty?)
|
5308
|
+
if (colspace == 'Indexed' and pal.empty?)
|
5290
5309
|
# Error('Missing palette in ' + file)
|
5291
5310
|
return false
|
5292
5311
|
end
|
@@ -5302,7 +5321,7 @@ class RBPDF
|
|
5302
5321
|
|
5303
5322
|
img = MiniMagick::Image.open(file)
|
5304
5323
|
img.format('png')
|
5305
|
-
if ['rgba', 'srgba', 'graya'].include?(img["%[channels]"].downcase)
|
5324
|
+
if ['rgba', 'srgba', 'graya'].include?(img["%[channels]"].downcase.split.first)
|
5306
5325
|
img.combine_options do |mogrify|
|
5307
5326
|
mogrify.channel 'matte'
|
5308
5327
|
mogrify.separate '+matte'
|
@@ -5314,6 +5333,7 @@ class RBPDF
|
|
5314
5333
|
# RMagick library
|
5315
5334
|
|
5316
5335
|
img = Magick::ImageList.new(file)
|
5336
|
+
img.format = 'png'
|
5317
5337
|
if img.alpha?
|
5318
5338
|
img.alpha Magick::ExtractAlphaChannel # PNG alpha channel Mask
|
5319
5339
|
else
|
@@ -5333,13 +5353,13 @@ class RBPDF
|
|
5333
5353
|
protected :image_alpha_mask
|
5334
5354
|
|
5335
5355
|
#
|
5336
|
-
# Extract info from a PNG image with alpha channel using the
|
5356
|
+
# Extract info from a PNG image with alpha channel using the RMagick/MiniMagick library.
|
5337
5357
|
# [@param string :file] Name of the file containing the image.
|
5338
5358
|
# [@param float :x] Abscissa of the upper-left corner.
|
5339
5359
|
# [@param float :y] Ordinate of the upper-left corner.
|
5340
5360
|
# [@param float :w] Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
|
5341
5361
|
# [@param float :h] Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
|
5342
|
-
# [@param string :type]
|
5362
|
+
# [@param string :type] Possible values are (case insensitive): JPEG and PNG (without RMagick/MiniMagick library) and PNG(with alpha channel) and JPEG and GIF and WebP supported by RMagick/MiniMagick. If not specified, the type is inferred from the file extension.
|
5343
5363
|
# [@param mixed :link] URL or identifier returned by AddLink().
|
5344
5364
|
# [@param string :align]
|
5345
5365
|
# Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
|
@@ -5347,7 +5367,7 @@ class RBPDF
|
|
5347
5367
|
# * M: middle-right for LTR or middle-left for RTL
|
5348
5368
|
# * B: bottom-right for LTR or bottom-left for RTL
|
5349
5369
|
# * N: next line
|
5350
|
-
# [@param boolean :resize] If true resize (reduce) the image to fit :w and :h (requires
|
5370
|
+
# [@param boolean :resize] If true resize (reduce) the image to fit :w and :h (requires RMagick/MiniMagick library).
|
5351
5371
|
# [@param int :dpi] dot-per-inch resolution used on resize
|
5352
5372
|
# [@param string :palign]
|
5353
5373
|
# Allows to center or align the image on the current line. Possible values are:
|
@@ -7446,7 +7466,7 @@ protected
|
|
7446
7466
|
trns='';
|
7447
7467
|
count_info = info['trns'].length
|
7448
7468
|
count_info.times do |i|
|
7449
|
-
trns << info['trns'][i] + ' ' + info['trns'][i] + ' '
|
7469
|
+
trns << info['trns'][i].to_s + ' ' + info['trns'][i].to_s + ' '
|
7450
7470
|
end
|
7451
7471
|
out << ' /Mask [' + trns + ']'
|
7452
7472
|
end
|
@@ -11102,7 +11122,7 @@ protected
|
|
11102
11122
|
operator = ''
|
11103
11123
|
lasttag = ''
|
11104
11124
|
attrib = ''
|
11105
|
-
while selector_offset = selector.index(/([\>\+\~\s]{1})([a-zA-Z0-9\*]+)([
|
11125
|
+
while selector_offset = selector.index(/([\>\+\~\s]{1})([a-zA-Z0-9\*]+)([^\>\+\s]*)/mi, selector_offset)
|
11106
11126
|
offset = selector_offset
|
11107
11127
|
selector_offset += $&.length
|
11108
11128
|
operator = $1
|
@@ -11122,18 +11142,19 @@ protected
|
|
11122
11142
|
when '[' # attribute
|
11123
11143
|
attrmatch = attrib.scan(/\[([a-zA-Z0-9]*)[\s]*([\~\^\$\*\|\=]*)[\s]*["]?([^"\]]*)["]?\]/i)
|
11124
11144
|
if !attrmatch.empty?
|
11125
|
-
att = attrmatch[0].downcase
|
11126
|
-
val = attrmatch[2]
|
11145
|
+
att = attrmatch[0][0].downcase
|
11146
|
+
val = attrmatch[0][2]
|
11147
|
+
|
11127
11148
|
if dom[key]['attribute'][att]
|
11128
|
-
case attrmatch[1]
|
11149
|
+
case attrmatch[0][1]
|
11129
11150
|
when '='
|
11130
11151
|
valid = true if dom[key]['attribute'][att] == val
|
11131
11152
|
when '~='
|
11132
11153
|
valid = true if dom[key]['attribute'][att].split(' ').include?(val)
|
11133
11154
|
when '^='
|
11134
|
-
valid = true if val ==
|
11155
|
+
valid = true if val == dom[key]['attribute'][att][0, val.length]
|
11135
11156
|
when '$='
|
11136
|
-
valid = true if val ==
|
11157
|
+
valid = true if val == dom[key]['attribute'][att][-val.length..-1]
|
11137
11158
|
when '*='
|
11138
11159
|
valid = true if dom[key]['attribute'][att].index(val) != nil
|
11139
11160
|
when '|='
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbpdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.21.
|
4
|
+
version: 1.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NAITOH Jun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|