pdf2docx.image.ImageBlock module#

Definition of Image block objects.

The raw image block will be merged into TextBlock > Line > Span.

class pdf2docx.image.ImageBlock.ImageBlock(raw: Optional[dict] = None)#

Bases: Image, Block

Image block.

bbox: fitz.Rect#
make_docx(p)#

Create floating image behind text.

Args:

p (Paragraph): python-docx paragraph instance.

Note

Inline image is created within TextBlock.

plot(page)#

Plot image bbox with diagonal lines (for debug purpose).

Args:

page (fitz.Page): pdf page to plot.

store()#

Store ImageBlock instance in raw dict.

to_text_block()#

Convert image block to a span under text block.

Returns:

TextBlock: New TextBlock instance containing this image.