Class: Vectory::Pdf

Inherits:
Vector show all
Defined in:
lib/vectory/pdf.rb

Instance Attribute Summary collapse

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, #height, #initialize, #mime, #path, #size, #to_uri, #width, #write

Methods inherited from Image

from_content, from_path, #initialize

Constructor Details

This class inherits a constructor from Vectory::Vector

Instance Attribute Details

#original_heightObject

Returns the value of attribute original_height.



5
6
7
# File 'lib/vectory/pdf.rb', line 5

def original_height
  @original_height
end

#original_widthObject

Returns the value of attribute original_width.



5
6
7
# File 'lib/vectory/pdf.rb', line 5

def original_width
  @original_width
end

Class Method Details

.default_extensionObject



7
8
9
# File 'lib/vectory/pdf.rb', line 7

def self.default_extension
  "pdf"
end

.mimetypeObject



11
12
13
# File 'lib/vectory/pdf.rb', line 11

def self.mimetype
  "application/pdf"
end

Instance Method Details

#to_emfObject



36
37
38
# File 'lib/vectory/pdf.rb', line 36

def to_emf
  with_inkscape_pdf_fallback(:emf, Emf)
end

#to_epsObject



28
29
30
# File 'lib/vectory/pdf.rb', line 28

def to_eps
  with_inkscape_pdf_fallback(:eps, Eps)
end

#to_psObject



32
33
34
# File 'lib/vectory/pdf.rb', line 32

def to_ps
  with_inkscape_pdf_fallback(:ps, Ps)
end

#to_svgObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vectory/pdf.rb', line 15

def to_svg
  svg = convert_to_svg

  # If we have original dimensions from EPS/PS, adjust the SVG
  if original_height && original_width
    adjusted_content = adjust_svg_dimensions(svg.content, original_width,
                                             original_height)
    svg = Svg.new(adjusted_content, svg.initial_path)
  end

  svg
end