Skip to content

Commit

Permalink
Fix documentation references to Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Jan 24, 2025
1 parent 51aea2e commit 7fac29b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 23 deletions.
1 change: 1 addition & 0 deletions docs/api_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Python API
:members:
.. autoclass:: Page()
:members:
:exclude-members: paint

.. module:: weasyprint.text.fonts
.. autoclass:: FontConfiguration()
Expand Down
4 changes: 1 addition & 3 deletions docs/first_steps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,7 @@ If you want more than a single PDF, the :meth:`HTML.render` method gives you a
:class:`document.Page` objects. Thus you can get the number of pages, their
size\ [#]_, the details of hyperlinks and bookmarks, etc. Documents also have a
:meth:`document.Document.write_pdf` method, and you can get a subset of the
pages with :meth:`document.Document.copy()`. Finally, for ultimate control,
:meth:`document.Page.paint` individual pages anywhere on any
:class:`pydyf.Stream`.
pages with :meth:`document.Document.copy()`.

.. [#] Pages in the same document do not always have the same size.
Expand Down
17 changes: 1 addition & 16 deletions weasyprint/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,7 @@ def __init__(self, page_box):
self._page_box = page_box

def paint(self, stream, scale=1):
"""Paint the page into the PDF file.
:type stream: ``document.Stream``
:param stream:
A document stream.
:param float left_x:
X coordinate of the left of the page, in PDF points.
:param float top_y:
Y coordinate of the top of the page, in PDF points.
:param float scale:
Zoom scale.
:param bool clip:
Whether to clip/cut content outside the page. If false or
not provided, content can overflow.
"""
"""Paint the page into the PDF file."""
with stacked(stream):
stream.transform(a=scale, d=scale)
draw_page(self._page_box, stream)
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/draw/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def draw_stacking_context(stream, stacking_context):


def draw_background(stream, bg, clip_box=True, bleed=None, marks=()):
"""Draw the background color and image to a ``document.Stream``.
"""Draw the background color and image to a ``pdf.stream.Stream``.
If ``clip_box`` is set to ``False``, the background is not clipped to the
border box of the background, but only to the painting area.
Expand Down Expand Up @@ -483,7 +483,7 @@ def add_horizontal(x, y):


def draw_replacedbox(stream, box):
"""Draw the given :class:`boxes.ReplacedBox` to a ``document.Stream``."""
"""Draw the given :class:`boxes.ReplacedBox` to a ``pdf.stream.Stream``."""
if box.style['visibility'] != 'visible' or not box.width or not box.height:
return

Expand Down
2 changes: 1 addition & 1 deletion weasyprint/draw/border.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def set_mask_border(stream, box):


def draw_border(stream, box):
"""Draw the box borders and column rules to a ``document.Stream``."""
"""Draw the box borders and column rules to a ``pdf.stream.Stream``."""

# The box is hidden, easy.
if box.style['visibility'] != 'visible':
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/draw/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def draw_first_line(stream, textbox, text_overflow, block_ellipsis, matrix):


def draw_text_decoration(stream, textbox, offset_x, offset_y, thickness, color):
"""Draw text-decoration of ``textbox`` to a ``document.Stream``."""
"""Draw text-decoration of ``textbox`` to a ``pdf.stream.Stream``."""
draw_line(
stream, textbox.position_x, textbox.position_y + offset_y,
textbox.position_x + textbox.width, textbox.position_y + offset_y,
Expand Down

0 comments on commit 7fac29b

Please sign in to comment.