election_day.utils.pdf_generator ================================ .. py:module:: election_day.utils.pdf_generator Classes ------- .. autoapisummary:: election_day.utils.pdf_generator.PdfGenerator Module Contents --------------- .. py:class:: PdfGenerator(app: onegov.election_day.app.ElectionDayApp, request: onegov.election_day.request.ElectionDayRequest, renderer: onegov.election_day.utils.d3_renderer.D3Renderer | None = None) .. py:attribute:: app .. py:attribute:: request .. py:attribute:: pdf_dir :value: 'pdf' .. py:attribute:: session .. py:attribute:: renderer .. py:method:: remove(directory: str, files: collections.abc.Collection[str]) -> None Safely removes the given files from the directory. .. py:method:: generate_pdf(item: onegov.election_day.models.Election | onegov.election_day.models.ElectionCompound | onegov.election_day.models.Vote, path: str, locale: str) -> None Generates the PDF for an election or a vote. .. py:method:: add_tacit_election(principal: onegov.election_day.models.Canton | onegov.election_day.models.Municipality, election: onegov.election_day.models.Election, pdf: onegov.election_day.pdf.Pdf) -> None .. py:method:: add_election(principal: onegov.election_day.models.Canton | onegov.election_day.models.Municipality, election: onegov.election_day.models.Election, pdf: onegov.election_day.pdf.Pdf) -> None .. py:method:: add_election_compound(principal: onegov.election_day.models.Canton | onegov.election_day.models.Municipality, compound: onegov.election_day.models.ElectionCompound, pdf: onegov.election_day.pdf.Pdf) -> None .. py:method:: add_vote(principal: onegov.election_day.models.Canton | onegov.election_day.models.Municipality, vote: onegov.election_day.models.Vote, pdf: onegov.election_day.pdf.Pdf, locale: str) -> None .. py:method:: create_pdfs() -> tuple[int, int] 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.