diff --git a/src/pypdfium2/_cli/render.py b/src/pypdfium2/_cli/render.py index dd055d65b..d849471b0 100644 --- a/src/pypdfium2/_cli/render.py +++ b/src/pypdfium2/_cli/render.py @@ -184,19 +184,19 @@ def main(args): kwargs = dict( page_indices = page_indices, + n_processes = args.processes, scale = args.scale, rotation = args.rotation, crop = args.crop, + greyscale = args.greyscale, color = args.background_color, color_scheme = color_scheme, fill_to_stroke = args.fill_to_stroke, - force_halftone = args.force_halftone, - greyscale = args.greyscale, optimise_mode = args.optimise_mode, draw_annots = not args.no_annotations, draw_forms = not args.no_forms, + force_halftone = args.force_halftone, rev_byteorder = args.rev_byteorder, - n_processes = args.processes, ) for type in args.no_antialias: kwargs["no_smooth%s" % type] = True diff --git a/src/pypdfium2/_helpers/document.py b/src/pypdfium2/_helpers/document.py index 2cd3b7751..5be557ee9 100644 --- a/src/pypdfium2/_helpers/document.py +++ b/src/pypdfium2/_helpers/document.py @@ -460,7 +460,7 @@ def render_tobytes(self, **kwargs): See :meth:`.PdfDocument._render_base` and :meth:`.PdfPage.render_base` for possible keyword arguments. Yields: - :class:`tuple`: Result of :meth:`.PdfPage.render_tobytes`. + Result of :meth:`.PdfPage.render_tobytes`. """ yield from self._render_base("bytes", **kwargs) @@ -472,7 +472,7 @@ def render_topil(self, **kwargs): See :meth:`.PdfDocument._render_base` and :meth:`.PdfPage.render_base` for possible keyword arguments. Yields: - :class:`PIL.Image.Image`: PIL image. + Result of :meth:`.PdfPage.render_topil`. """ yield from self._render_base("pil", **kwargs) @@ -484,7 +484,7 @@ def render_tonumpy(self, **kwargs): See :meth:`.PdfDocument._render_base` and :meth:`.PdfPage.render_base` for possible keyword arguments. Yields: - (:class:`numpy.ndarray`, str): NumPy array, and color format. + Result of :meth:`.PdfPage.render_tonumpy`. """ yield from self._render_base("numpy", **kwargs) diff --git a/src/pypdfium2/_helpers/page.py b/src/pypdfium2/_helpers/page.py index 024275cc2..58e02906f 100644 --- a/src/pypdfium2/_helpers/page.py +++ b/src/pypdfium2/_helpers/page.py @@ -292,6 +292,9 @@ def render_base( Amount in PDF canvas units to cut off from page borders (left, bottom, right, top). Crop is applied after rotation. + greyscale (bool): + Whether to render in greyscale mode (no colors). + color (typing.Tuple[int, int, int, int]): Page background color. Shall be a list of values for red, green, blue and alpha, ranging from 0 to 255. For RGB, 0 will include nothing of the color in question, while 255 will fully include it. @@ -303,9 +306,6 @@ def render_base( fill_to_stroke (bool): Whether fill paths need to be stroked. This option is ignored if *color_scheme* is :data:`None`. - greyscale (bool): - Whether to render in greyscale mode (no colors). - optimise_mode (OptimiseMode): How to optimise page rendering.