Class: Decidim::Exporters::PDF

Inherits:
Exporter
  • Object
show all
Includes:
SanitizeHelper, TranslatableAttributes
Defined in:
decidim-core/lib/decidim/exporters/pdf.rb

Overview

Exports a PDF using the provided hash, given a collection and a Serializer. This is an abstract class that should be inherited to create PDF exporters, with each PDF exporter class setting the desired template, layout and orientation.

Direct Known Subclasses

FormPDF, InitiativeVotesPDF

Instance Method Summary collapse

Methods included from SanitizeHelper

#decidim_escape_translated, #decidim_html_escape, #decidim_rich_text, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included

Methods included from TranslatableAttributes

#attachment?, #default_locale?

Methods inherited from Exporter

#initialize

Constructor Details

This class inherits a constructor from Decidim::Exporters::Exporter

Instance Method Details

#exportObject

Public: Exports a PDF version of the collection by rendering the template into html and then converting it to PDF.

Returns an ExportData instance.



20
21
22
23
24
25
26
# File 'decidim-core/lib/decidim/exporters/pdf.rb', line 20

def export
  composer.styles(**styles)

  add_data!

  ExportData.new(composer.write_to_string, "pdf")
end