gazette.pdf =========== .. py:module:: gazette.pdf Classes ------- .. autoapisummary:: gazette.pdf.Pdf gazette.pdf.IndexPdf gazette.pdf.NoticesPdf gazette.pdf.IssuePdf gazette.pdf.IssuePrintOnlyPdf Module Contents --------------- .. py:class:: Pdf(*args: Any, toc_levels: int = 3, created: str = '', logo: str | None = None, link_color: str | None = None, underline_links: bool = False, underline_width: float | str = 0.5, skip_numbering: bool = False, **kwargs: Any) Bases: :py:obj:`onegov.pdf.Pdf` A PDF document. .. py:method:: adjust_style(font_size: int = 10) -> None Adds styles for notices. .. py:class:: IndexPdf(*args: Any, toc_levels: int = 3, created: str = '', logo: str | None = None, link_color: str | None = None, underline_links: bool = False, underline_width: float | str = 0.5, skip_numbering: bool = False, **kwargs: Any) Bases: :py:obj:`Pdf` A PDF document. .. py:method:: adjust_style(font_size: int = 10) -> None Adds styles for notices. .. py:method:: category_index(notices: onegov.gazette.collections.GazetteNoticeCollection) -> None Adds a category index. .. py:method:: organization_index(notices: onegov.gazette.collections.GazetteNoticeCollection) -> None Adds an organization index. .. py:method:: from_notices(notices: onegov.gazette.collections.GazetteNoticeCollection, request: onegov.gazette.request.GazetteRequest) -> io.BytesIO :classmethod: Create an index PDF from a collection of notices. .. py:class:: NoticesPdf(*args: Any, toc_levels: int = 3, created: str = '', logo: str | None = None, link_color: str | None = None, underline_links: bool = False, underline_width: float | str = 0.5, skip_numbering: bool = False, **kwargs: Any) Bases: :py:obj:`Pdf` A PDF document. .. py:method:: adjust_style(font_size: int = 10) -> None Adds styles for notices. .. py:method:: notice(notice: onegov.gazette.models.GazetteNotice, layout: onegov.gazette.layout.Layout, publication_number: int | str = 'xxx') -> None Adds an official notice. .. py:method:: from_notice(notice: onegov.gazette.models.GazetteNotice, request: onegov.gazette.request.GazetteRequest) -> io.BytesIO :classmethod: Create a PDF from a single notice. .. py:method:: from_notices(notices: onegov.gazette.collections.GazetteNoticeCollection, request: onegov.gazette.request.GazetteRequest) -> io.BytesIO :classmethod: Create a PDF from a collection of notices. .. py:class:: IssuePdf(*args: Any, toc_levels: int = 3, created: str = '', logo: str | None = None, link_color: str | None = None, underline_links: bool = False, underline_width: float | str = 0.5, skip_numbering: bool = False, **kwargs: Any) Bases: :py:obj:`NoticesPdf` A PDF containing all the notices of a single issue. Allows to automatically assign publication numbers when generating the PDF. .. py:method:: h(title: str, level: int = 0) -> None Adds a title according to the given level. .. py:method:: notice(notice: onegov.gazette.models.GazetteNotice, layout: onegov.gazette.layout.Layout, publication_number: int | str = 'xxx') -> None Adds an official notice. Hides the content if it is print only. .. py:method:: excluded_notices_note(number: int, request: onegov.gazette.request.GazetteRequest) -> None Adds a paragraph with the number of excluded (print only) notices. .. py:method:: unfold_data(session: sqlalchemy.orm.Session, layout: onegov.gazette.layout.Layout, issue: str, data: list[dict[str, Any]], publication_number: int | None, level: int = 1) -> int | None Take a nested list of dicts and add it. .. py:method:: query_notices(session: sqlalchemy.orm.Session, issue: str, organization: str, category: str) -> list[uuid.UUID] :staticmethod: Queries all notices with the given values, ordered by publication number. .. py:method:: query_used_categories(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) -> set[str] :classmethod: .. py:method:: query_used_organizations(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) -> set[str] :classmethod: .. py:method:: query_excluded_notices_count(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) -> int :classmethod: .. py:method:: from_issue(issue: onegov.gazette.models.Issue, request: onegov.gazette.request.GazetteRequest, first_publication_number: int | None, links: dict[str, str] | None = None) -> io.BytesIO :classmethod: Generate a PDF for one issue. Uses `first_publication_number` as a starting point for assigning publication numbers. Uses the existing numbers of the notices if None. .. py:class:: IssuePrintOnlyPdf(*args: Any, toc_levels: int = 3, created: str = '', logo: str | None = None, link_color: str | None = None, underline_links: bool = False, underline_width: float | str = 0.5, skip_numbering: bool = False, **kwargs: Any) Bases: :py:obj:`IssuePdf` A PDF containing all the print only notices of a single issue. Generating this PDF does NOT assigns publication numbers! .. py:method:: notice(notice: onegov.gazette.models.GazetteNotice, layout: onegov.gazette.layout.Layout, publication_number: str | int = 'xxx') -> None Adds an official notice. .. py:method:: excluded_notices_note(number: int, request: onegov.gazette.request.GazetteRequest) -> None Adds a paragraph with the number of excluded (print only) notices. .. py:method:: query_notices(session: sqlalchemy.orm.Session, issue: str, organization: str, category: str) -> list[uuid.UUID] :staticmethod: Queries all notices with the given values, ordered by publication number. .. py:method:: query_used_categories(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) -> set[str] :classmethod: .. py:method:: query_used_organizations(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) -> set[str] :classmethod: .. py:method:: from_issue(issue: onegov.gazette.models.Issue, request: onegov.gazette.request.GazetteRequest) -> io.BytesIO :classmethod: Generate a PDF for one issue.