gazette.pdf

Module Contents

Classes

Pdf

A PDF document.

IndexPdf

A PDF document.

NoticesPdf

A PDF document.

IssuePdf

A PDF containing all the notices of a single issue.

IssuePrintOnlyPdf

A PDF containing all the print only notices of a single issue.

class gazette.pdf.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, **kwargs: Any)[source]

Bases: onegov.pdf.Pdf

A PDF document.

adjust_style(font_size: int = 10) None[source]

Adds styles for notices.

class gazette.pdf.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, **kwargs: Any)[source]

Bases: Pdf

A PDF document.

adjust_style(font_size: int = 10) None[source]

Adds styles for notices.

category_index(notices: onegov.gazette.collections.GazetteNoticeCollection) None[source]

Adds a category index.

organization_index(notices: onegov.gazette.collections.GazetteNoticeCollection) None[source]

Adds an organization index.

classmethod from_notices(notices: onegov.gazette.collections.GazetteNoticeCollection, request: onegov.gazette.request.GazetteRequest) io.BytesIO[source]

Create an index PDF from a collection of notices.

class gazette.pdf.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, **kwargs: Any)[source]

Bases: Pdf

A PDF document.

adjust_style(font_size: int = 10) None[source]

Adds styles for notices.

notice(notice: onegov.gazette.models.GazetteNotice, layout: onegov.gazette.layout.Layout, publication_number: int | str = 'xxx') None[source]

Adds an official notice.

classmethod from_notice(notice: onegov.gazette.models.GazetteNotice, request: onegov.gazette.request.GazetteRequest) io.BytesIO[source]

Create a PDF from a single notice.

classmethod from_notices(notices: onegov.gazette.collections.GazetteNoticeCollection, request: onegov.gazette.request.GazetteRequest) io.BytesIO[source]

Create a PDF from a collection of notices.

class gazette.pdf.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, **kwargs: Any)[source]

Bases: NoticesPdf

A PDF containing all the notices of a single issue.

Allows to automatically assign publication numbers when generating the PDF.

h(title: str, level: int = 0) None[source]

Adds a title according to the given level.

notice(notice: onegov.gazette.models.GazetteNotice, layout: onegov.gazette.layout.Layout, publication_number: int | str = 'xxx') None[source]

Adds an official notice. Hides the content if it is print only.

excluded_notices_note(number: int, request: onegov.gazette.request.GazetteRequest) None[source]

Adds a paragraph with the number of excluded (print only) notices.

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[source]

Take a nested list of dicts and add it.

static query_notices(session: sqlalchemy.orm.Session, issue: str, organization: str, category: str) list[uuid.UUID][source]

Queries all notices with the given values, ordered by publication number.

classmethod query_used_categories(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) set[str][source]
classmethod query_used_organizations(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) set[str][source]
classmethod query_excluded_notices_count(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) int[source]
classmethod 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[source]

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.

class gazette.pdf.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, **kwargs: Any)[source]

Bases: IssuePdf

A PDF containing all the print only notices of a single issue.

Generating this PDF does NOT assigns publication numbers!

notice(notice: onegov.gazette.models.GazetteNotice, layout: onegov.gazette.layout.Layout, publication_number: str | int = 'xxx') None[source]

Adds an official notice.

excluded_notices_note(number: int, request: onegov.gazette.request.GazetteRequest) None[source]

Adds a paragraph with the number of excluded (print only) notices.

static query_notices(session: sqlalchemy.orm.Session, issue: str, organization: str, category: str) list[uuid.UUID][source]

Queries all notices with the given values, ordered by publication number.

classmethod query_used_categories(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) set[str][source]
classmethod query_used_organizations(session: sqlalchemy.orm.Session, issue: onegov.gazette.models.Issue) set[str][source]
classmethod from_issue(issue: onegov.gazette.models.Issue, request: onegov.gazette.request.GazetteRequest) io.BytesIO[source]

Generate a PDF for one issue.