Class: Vectory::Eps
Instance Attribute Summary
Attributes inherited from Vector
#initial_path
Attributes inherited from Image
#content
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Vector
#file_size, from_datauri, from_path, #initialize, #mime, #path, #size, #to_uri, #write
Methods inherited from Image
from_content, from_path, #initialize
Class Method Details
.default_extension ⇒ Object
5
6
7
|
# File 'lib/vectory/eps.rb', line 5
def self.default_extension
"eps"
end
|
.from_node(node) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/vectory/eps.rb', line 13
def self.from_node(node)
return from_content(node.children.to_xml) unless node.text.strip.empty?
uri = node["src"]
return Vectory::Datauri.new(uri).to_vector if %r{^data:}.match?(uri)
from_path(uri)
end
|
.mimetype ⇒ Object
9
10
11
|
# File 'lib/vectory/eps.rb', line 9
def self.mimetype
"application/postscript"
end
|
Instance Method Details
#height ⇒ Object
46
47
48
49
50
51
|
# File 'lib/vectory/eps.rb', line 46
def height
bbox = parse_bounding_box
return super unless bbox
bbox[:ury] - bbox[:lly]
end
|
#to_emf ⇒ Object
30
31
32
|
# File 'lib/vectory/eps.rb', line 30
def to_emf
to_pdf.to_emf
end
|
#to_pdf ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/vectory/eps.rb', line 34
def to_pdf
pdf_content = GhostscriptWrapper.convert(content, eps_crop: true)
pdf = Pdf.new(pdf_content)
bbox = parse_bounding_box
if bbox
pdf.original_width = bbox[:urx] - bbox[:llx]
pdf.original_height = bbox[:ury] - bbox[:lly]
end
pdf
end
|
#to_ps ⇒ Object
22
23
24
|
# File 'lib/vectory/eps.rb', line 22
def to_ps
to_pdf.to_ps
end
|
#to_svg ⇒ Object
26
27
28
|
# File 'lib/vectory/eps.rb', line 26
def to_svg
to_pdf.to_svg
end
|
#width ⇒ Object
53
54
55
56
57
58
|
# File 'lib/vectory/eps.rb', line 53
def width
bbox = parse_bounding_box
return super unless bbox
bbox[:urx] - bbox[:llx]
end
|