Ejemplo n.º 1
0
def test_simple_qr_stamp(tmp_path):
    outfile: Path = tmp_path / "test-out.pdf"
    qr_stamp_file(
        MINIMAL_PATH, str(outfile),
        QRStampStyle(stamp_text="Hi, it's\n%(ts)s"),
        dest_page=0, x=70, y=50, url='https://example.com'
    )
Ejemplo n.º 2
0
def test_simple_qr_noto_stamp(tmp_path):
    outfile: Path = tmp_path / "test-out.pdf"

    ga_factory = GlyphAccumulatorFactory(NOTO_SERIF_JP)
    qr_stamp_file(
        MINIMAL_PATH, str(outfile),
        QRStampStyle(stamp_text="Hi, it's\n%(ts)s",
                     text_box_style=TextBoxStyle(font=ga_factory)),
        dest_page=0, x=70, y=50, url='https://example.com',
    )
Ejemplo n.º 3
0
def stamp(ctx, infile, outfile, x, y, style_name, page, stamp_url):
    with pyhanko_exception_manager():
        stamp_style = _select_style(ctx, style_name, stamp_url)
        page_ix = _index_page(page)
        if stamp_url:
            qr_stamp_file(infile,
                          outfile,
                          stamp_style,
                          dest_page=page_ix,
                          x=x,
                          y=y,
                          url=stamp_url)
        else:
            text_stamp_file(infile,
                            outfile,
                            stamp_style,
                            dest_page=page_ix,
                            x=x,
                            y=y)