election_day.utils.pdf_generator

Module Contents

Classes

PdfGenerator

class election_day.utils.pdf_generator.PdfGenerator(app: onegov.election_day.app.ElectionDayApp, request: onegov.election_day.request.ElectionDayRequest, renderer: onegov.election_day.utils.d3_renderer.D3Renderer | None = None)[source]
remove(directory: str, files: Collection[str]) None[source]

Safely removes the given files from the directory.

generate_pdf(item: onegov.ballot.Election | onegov.ballot.ElectionCompound | onegov.ballot.Vote, path: str, locale: str) None[source]

Generates the PDF for an election or a vote.

add_tacit_election(principal: Canton | Municipality, election: onegov.ballot.Election, pdf: onegov.election_day.pdf.Pdf) None[source]
add_election(principal: Canton | Municipality, election: onegov.ballot.Election, pdf: onegov.election_day.pdf.Pdf) None[source]
add_election_compound(principal: Canton | Municipality, compound: onegov.ballot.ElectionCompound, pdf: onegov.election_day.pdf.Pdf) None[source]
add_vote(principal: Canton | Municipality, vote: onegov.ballot.Vote, pdf: onegov.election_day.pdf.Pdf, locale: str) None[source]
create_pdfs() tuple[int, int][source]

Generates all PDFs for the given application.

Only generates PDFs if not already generated since the last change of the election, election compound or vote.

Cleans up unused files.