Ejemplo n.º 1
0
def do_main(argv):
    out_files = ["customsmask15.pdf",
                  "customsmask14.pdf",
                  "customsmask13.pdf"]
    # (2,3,1) - removed
    for index, version, strict in [(1,4,1), (0,5,1), (2,3,0)]:
        if version < 4 and strict:
            checker = testlib.must_throw
            cfg = testlib.test_config()
            cfg.set("doc.version", str(version))
            cfg.set("doc.strict_mode", str(strict))
            cfg.set("images.softmask_16_to_8", str(0))
            doc = jagpdf.create_stream(testlib.NoopStreamOut(), cfg)
        else:
            checker = lambda fn, *args: fn(*args)
        doc, cfg = testlib.get_legacy_doc(argv,
                                           out_files[index],
                                           { 'doc.version' : version,
                                             'doc.strict_mode' : strict,
                                             'images.softmask_16_to_8' : 0 })
        g_font.set_writer(doc)
        g_softmask.set_doc(doc)
        checker(do_grayscale, doc)
        checker(do_rgb, doc)
        checker(do_cmyk, doc)
        doc.finalize()
Ejemplo n.º 2
0
def do_it():
    prof = jagpdf.create_profile_from_string(s_profile)
    stream = testlib.NoopStreamOut()
    doc = jagpdf.create_stream(stream)
    doc.page_start(5.9*72, 3.5*72)
    canvas = doc.page().canvas()
    # meat
    img = doc.image_load_file(s_jpeg_file)
    canvas.image(img, 50, 50)
    canvas.text(10, 10, 200 * 'a')
    canvas.move_to(10, 10)
    canvas.line_to(20, 20)
    canvas.path_paint("fs")
    font_ttf = testlib.EasyFontTTF(doc)(10)
    font_core = testlib.EasyFont(doc)(10)
    canvas.text_font(font_ttf)
    canvas.text(10, 10, 50 * 'x')
    font_ttf.advance('abcdefghijklmnopqrstuvwxyz')
    canvas.text_font(font_core)
    canvas.text(10, 10, 50 * 'y')
    font_core.advance('abcdefghijklmnopqrstuvwxyz')
    # finalize
    doc.page_end()
    doc.finalize()
    # touch the result
    s = 0
    for b in stream.content():
        s = s + ord(b)
Ejemplo n.º 3
0
def cannot_output_font(easy_font, enc=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    fnt = easy_font(doc, enc)
    doc.page_start(*testlib.paperA5)
    canvas = doc.page().canvas()
    canvas.text_font(fnt())
    canvas.state_save()
    canvas.state_restore()
    doc.page_end()
    testlib.must_throw_ex("font", doc.finalize)
Ejemplo n.º 4
0
def cannot_output_font(easy_font, enc=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    fnt = easy_font(doc, enc)
    doc.page_start(*testlib.paperA5)
    canvas = doc.page().canvas()
    canvas.text_font(fnt())
    canvas.state_save()
    canvas.state_restore()
    doc.page_end()
    testlib.must_throw_ex("font", doc.finalize)
Ejemplo n.º 5
0
def error_injection():
    # reject non-roman alphabet
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    fnt = doc.font_load("standard; name=Helvetica; size=12; enc=utf-8")
    doc.page_start(500, 500)
    canvas = doc.page().canvas()
    canvas.text_font(fnt)
    #testlib.must_throw(canvas.text, 10, 10, "\xd0\x96\xd1\x86\xd0\xba")
    doc.page_end()
    doc.finalize()
Ejemplo n.º 6
0
def error_injection():
    # reject non-roman alphabet
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    fnt = doc.font_load("standard; name=Helvetica; size=12; enc=utf-8")
    doc.page_start(500, 500)
    canvas = doc.page().canvas()
    canvas.text_font(fnt)
    #testlib.must_throw(canvas.text, 10, 10, "\xd0\x96\xd1\x86\xd0\xba")
    doc.page_end()
    doc.finalize()
Ejemplo n.º 7
0
def test_main(argv=None):
    if None == argv:
        argv = sys.argv
    out_file = os.path.abspath(os.path.join(argv[1], 'basic_extstream.pdf'))
    cfg = testlib.test_config()
    doc = jagpdf.create_stream(testlib.FileStreamOut(out_file), cfg)
    doc.page_start(5.9 * 72, 3.5 * 72)
    writer = doc.page().canvas()
    doc.page_end()
    doc.finalize()
    doc = None
Ejemplo n.º 8
0
def test_faults():
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(72, 72)
    canvas = doc.page().canvas()
    # cannot use simple text inside a text object
    canvas.text_start(0, 0)
    testlib.must_throw(canvas.text, 10, 10, "No!")
    canvas.text_end()
    canvas.text(10, 10, "Yes")
    doc.page_end()
    doc.finalize()
Ejemplo n.º 9
0
def test_faults():
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(72, 72)
    canvas = doc.page().canvas()
    # cannot use simple text inside a text object
    canvas.text_start(0, 0)
    testlib.must_throw(canvas.text, 10, 10, "No!")
    canvas.text_end()
    canvas.text(10, 10, "Yes")
    doc.page_end()
    doc.finalize()
Ejemplo n.º 10
0
def test_main(argv=None):
    if None == argv:
        argv = sys.argv
    out_file = os.path.abspath(os.path.join(argv[1], 'basic_extstream.pdf'))
    cfg = testlib.test_config()
    doc = jagpdf.create_stream(testlib.FileStreamOut(out_file), cfg)
    doc.page_start(5.9*72, 3.5*72)
    writer = doc.page().canvas()
    doc.page_end()
    doc.finalize()
    doc = None
Ejemplo n.º 11
0
def test_main(argv=None):
    #
    # typemanager with no default font set
    #
    cfg = jagpdf.create_profile()
    cfg.set('fonts.fallback', '')
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    test_suite_fail(doc, [
        'this-font-does-not-exist', 'FreeType call failed',
        '/this/file/does/not/exist'
    ])
    doc.finalize()
    #
    # typemanager with nonexisting default font
    #
    cfg = jagpdf.create_profile()
    cfg.set('fonts.fallback', 'file=nonexisting-default')
    doc = jagpdf.create_stream(testlib.NoopStreamOut(), cfg)
    default_typeface_failure = 'Default typeface not found'
    test_suite_fail(doc, [(default_typeface_failure, 'nonexisting-default',
                           'this-font-does-not-exist'),
                          (default_typeface_failure, 'nonexisting-default',
                           'FreeType call failed'),
                          (default_typeface_failure, 'nonexisting-default',
                           '/this/file/does/not/exist')])
    doc.finalize()
    #
    #
    #
    default_fonts = [
        ('file=' + dejavu_ttf, 'DejaVu Sans'),
        ('standard;name=Helvetica', 'Helvetica'),
    ]
    if testlib.is_windows():
        default_fonts.append(('name=Arial;enc=windows-1252', 'Arial'))
    for default_font, fullname in default_fonts:
        cfg = jagpdf.create_profile()
        cfg.set('fonts.fallback', default_font)
        doc = jagpdf.create_stream(testlib.NoopStreamOut(), cfg)
        test_suite_ok(doc, fullname)
        doc.finalize()
Ejemplo n.º 12
0
def fault_injection():
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    outline = doc.outline()
    testlib.must_throw(outline.item, "Invalid bookmark")
    outline.state_save()
    doc.page_start(5.9*72, g_page_height)
    testlib.must_throw(outline.level_down)
    testlib.must_throw(outline.level_up)
    doc.page_end()
    outline.state_restore()
    testlib.must_throw(outline.state_restore)
    doc.finalize()
Ejemplo n.º 13
0
def test_main(argv=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(*dim)
    canvas = doc.page().canvas()
    testlib.must_throw(canvas.line_to, 20, 20)
    testlib.must_throw(canvas.path_paint, 'f')
    canvas.text_start(0, 0)
    testlib.must_throw(canvas.text, 10, 10, "Not allowed here!")
    canvas.text("This is OK")
    canvas.text_end()
    doc.page_end()
    doc.finalize()
Ejemplo n.º 14
0
def fault_injection():
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    outline = doc.outline()
    testlib.must_throw(outline.item, "Invalid bookmark")
    outline.state_save()
    doc.page_start(5.9 * 72, g_page_height)
    testlib.must_throw(outline.level_down)
    testlib.must_throw(outline.level_up)
    doc.page_end()
    outline.state_restore()
    testlib.must_throw(outline.state_restore)
    doc.finalize()
Ejemplo n.º 15
0
def test_main(argv=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(*dim)
    canvas = doc.page().canvas()
    testlib.must_throw(canvas.line_to, 20, 20)
    testlib.must_throw(canvas.path_paint, 'f')
    canvas.text_start(0, 0)
    testlib.must_throw(canvas.text, 10, 10, "Not allowed here!")
    canvas.text("This is OK")
    canvas.text_end()
    doc.page_end()
    doc.finalize()
Ejemplo n.º 16
0
def test_main(argv=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(597.6, 848.68)
    canvas = doc.page().canvas()
    #
    gradient = doc.function_2_load("domain=0, 1; c0=0; c1=1")
    p = doc.shading_pattern_load("axial; coords=0, 0, 400, 400",
                                 jagpdf.CS_DEVICE_GRAY, gradient)
    # cannot set pattern because the pattern color space has not been set
    testlib.must_throw(canvas.pattern, "f", p)
    #
    doc.page_end()
    doc.finalize()
Ejemplo n.º 17
0
def test_main(argv=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut(),
                               jagpdf.create_profile())
    doc.page_start(5.9 * 72, 3.5 * 72)
    writer = doc.page().canvas()
    # the following operations must fail as they require path construction
    # to be already started
    testlib.must_throw(writer.bezier_to, 1, 2, 3, 4, 5, 6)
    testlib.must_throw(writer.bezier_to_1st_ctrlpt, 0, 0, 0, 0)
    testlib.must_throw(writer.bezier_to_2nd_ctrlpt, 0, 0, 0, 0)
    testlib.must_throw(writer.line_to, 0, 0)
    testlib.must_throw(writer.path_close)
    doc.page_end()
    doc.finalize()
Ejemplo n.º 18
0
def test_main(argv=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut(),
                                    jagpdf.create_profile())
    doc.page_start(5.9*72, 3.5*72)
    writer = doc.page().canvas()
    # the following operations must fail as they require path construction
    # to be already started
    testlib.must_throw(writer.bezier_to, 1, 2, 3, 4, 5, 6)
    testlib.must_throw(writer.bezier_to_1st_ctrlpt, 0, 0, 0, 0)
    testlib.must_throw(writer.bezier_to_2nd_ctrlpt, 0, 0, 0, 0 )
    testlib.must_throw(writer.line_to, 0, 0)
    testlib.must_throw(writer.path_close)
    doc.page_end()
    doc.finalize()
Ejemplo n.º 19
0
def test_main(argv=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(597.6, 848.68)
    canvas = doc.page().canvas()
    #
    gradient = doc.function_2_load("domain=0, 1; c0=0; c1=1")
    p = doc.shading_pattern_load("axial; coords=0, 0, 400, 400",
                                 jagpdf.CS_DEVICE_GRAY,
                                 gradient)
    # cannot set pattern because the pattern color space has not been set
    testlib.must_throw(canvas.pattern, "f", p)
    #
    doc.page_end()
    doc.finalize()
Ejemplo n.º 20
0
def test_main(argv=None):
    #
    # typemanager with no default font set
    #
    cfg = jagpdf.create_profile()
    cfg.set('fonts.fallback', '')
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    test_suite_fail(doc, ['this-font-does-not-exist',
                    'FreeType call failed',
                    '/this/file/does/not/exist'])
    doc.finalize()
    #
    # typemanager with nonexisting default font
    #
    cfg = jagpdf.create_profile()
    cfg.set('fonts.fallback', 'file=nonexisting-default')
    doc = jagpdf.create_stream(testlib.NoopStreamOut(), cfg)
    default_typeface_failure = 'Default typeface not found'
    test_suite_fail(doc, [(default_typeface_failure, 'nonexisting-default', 'this-font-does-not-exist'),
                           (default_typeface_failure, 'nonexisting-default', 'FreeType call failed'),
                           (default_typeface_failure, 'nonexisting-default', '/this/file/does/not/exist')])
    doc.finalize()
    #
    #
    #
    default_fonts = [('file=' + dejavu_ttf, 'DejaVu Sans'),
                      ('standard;name=Helvetica', 'Helvetica'),
                     ]
    if testlib.is_windows():
        default_fonts.append(('name=Arial;enc=windows-1252', 'Arial'))
    for default_font, fullname in default_fonts:
        cfg = jagpdf.create_profile()
        cfg.set('fonts.fallback', default_font)
        doc = jagpdf.create_stream(testlib.NoopStreamOut(), cfg)
        test_suite_ok(doc, fullname)
        doc.finalize()
Ejemplo n.º 21
0
def test_main(argv=None):
    cfg = testlib.test_config()

    # normal functionality
    cfg.set('doc.version', "3")
    writer = testlib.create_test_doc(argv,'color-space-str-def.pdf', cfg)
    g_font.set_writer(writer)
    do_page(writer)
    writer.finalize()

    # expected failures
    cfg.set('doc.version', "2")
    writer = jagpdf.create_stream(testlib.NoopStreamOut(), cfg)
    g_font.set_writer(writer)
    do_failures_v2(writer)
    writer.finalize()
Ejemplo n.º 22
0
def check_errors():
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(1, 1)
    canvas = doc.page().canvas()
    colored = create_col_pattern(doc, 1)
    uncolored = create_uncol_pattern(doc, 1)
    #
    canvas.color_space_pattern('fs')
    testlib.must_throw(canvas.pattern, 'fs', colored, 1)
    canvas.pattern('fs', uncolored, 1)     # should throw
    #
    canvas.color_space_pattern_uncolored('fs', jagpdf.CS_DEVICE_CMYK)
    testlib.must_throw(canvas.pattern, 'fs', uncolored)
    canvas.pattern('fs', colored)     # should throw
    doc.page_end()
    doc.finalize()
Ejemplo n.º 23
0
def check_errors():
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(1, 1)
    fn = function(doc, 'double_dot')
    sh = doc.shading_pattern_load("function; matrix_fun=100, 0, 0, 100, 50, 50", jagpdf.CS_DEVICE_GRAY, fn)
    canvas = doc.page().canvas()
    canvas.color_space_pattern('fs')
    testlib.must_throw(canvas.pattern, 'fs', sh, 1)
    canvas.color_space_pattern_uncolored('fs', jagpdf.CS_DEVICE_GRAY)
    canvas.pattern('fs', sh) # should throw
    # indexed not allowed pattern spaces
    indexed_cs = doc.color_space_load("adobe-rgb; palette=77, 179, 102")
    fn = doc.function_2_load("c0=1.0, 0.0, 0.0; c1=0.0, 0.0, 1.0")
    testlib.must_throw(doc.shading_pattern_load, "axial; coords=50, 50, 150, 150", indexed_cs, fn)
    doc.page_end()
    doc.finalize()
Ejemplo n.º 24
0
def test_main(argv=None):
    cfg = testlib.test_config()

    # normal functionality
    cfg.set('doc.version', "3")
    writer = testlib.create_test_doc(argv, 'color-space-str-def.pdf', cfg)
    g_font.set_writer(writer)
    do_page(writer)
    writer.finalize()

    # expected failures
    cfg.set('doc.version', "2")
    writer = jagpdf.create_stream(testlib.NoopStreamOut(), cfg)
    g_font.set_writer(writer)
    do_failures_v2(writer)
    writer.finalize()
Ejemplo n.º 25
0
def check_errors():
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(1, 1)
    canvas = doc.page().canvas()
    colored = create_col_pattern(doc, 1)
    uncolored = create_uncol_pattern(doc, 1)
    #
    canvas.color_space_pattern('fs')
    testlib.must_throw(canvas.pattern, 'fs', colored, 1)
    canvas.pattern('fs', uncolored, 1)  # should throw
    #
    canvas.color_space_pattern_uncolored('fs', jagpdf.CS_DEVICE_CMYK)
    testlib.must_throw(canvas.pattern, 'fs', uncolored)
    canvas.pattern('fs', colored)  # should throw
    doc.page_end()
    doc.finalize()
Ejemplo n.º 26
0
def test_main(argv=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut(), jagpdf.create_profile())
    #doc.finalize()

    patt_canvas = doc.canvas_create()
    testlib.must_throw(doc.tiling_pattern_load,
                       "step=0, 0",
                       patt_canvas) # empty canvas
    patt_canvas.move_to(5, 5)
    patt_canvas.line_to(15, 15)
    patt_canvas.path_paint("fs")
    testlib.must_throw(doc.tiling_pattern_load,
                       "matrix=1, 0, 0, 1, 0, 0",
                       patt_canvas) # no step
    patt_id = doc.tiling_pattern_load("step=20, 20", patt_canvas)

    # use pattern
    doc.page_start(5.9*72, 3.5*72)
    writer = doc.page().canvas()
    writer.color_space_pattern_uncolored("f", jagpdf.CS_DEVICE_GRAY)
    writer.pattern("f", patt_id, .5)
    writer.rectangle(36, 36, 144, 144)
    writer.path_paint("sf")

    #try to write to pattern that is already registered
    patt_canvas.rectangle(7, 7, 6, 6)
    patt_canvas.path_paint("fs")
    writer.rectangle(36+144+4, 36, 144, 144)
    writer.path_paint("sf")


    doc.page_end()

    # !!!! suprising - try to write to pattern that is already outputted
    patt_canvas.circle(10, 10, 5)
    patt_canvas.path_paint("s")


    # !!!! this is wild -> this caused abort
    try:
        patt_canvas.paint("fs")
    except AttributeError:
        pass
    else:
        assert 0

    doc.finalize()
Ejemplo n.º 27
0
def test_main(argv=None):
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    # function 2
    doc.function_2_load("domain=0.0, 1.0; c0=1; c1=2")
    doc.function_2_load("domain=0.0, 1.0")
    f1 = doc.function_2_load("c0=11; c1=12")
    f2 = doc.function_2_load("exponent=2")
    doc.function_2_load("")
    doc.function_2_load("c1=12")
    testlib.must_throw(doc.function_2_load, "c0=11; c1=12,23")
    testlib.must_throw(doc.function_2_load, "c1=12,23")
    # function 3
    doc.function_3_load("bounds=0.3; encode=0, 1, 0, 1", [f1, f2])
    # function 4

    doc.page_start(10, 10)
    doc.page_end()
    doc.finalize()
Ejemplo n.º 28
0
def test_main(argv=None):
    #raw_input('.......')
    if argv==None:
        argv=sys.argv
    out_file = os.path.abspath(os.path.join(argv[1], 'pattern-nonstd-op.pdf'))
    cfg = testlib.test_config()
    doc = jagpdf.create_stream(testlib.FileStreamOut(out_file), cfg)

    patt_canvas = doc.canvas_create()
    testlib.must_throw(doc.tiling_pattern_load,
                       "step=0, 0",
                       patt_canvas) # empty canvas
    patt_canvas.move_to(5, 5)
    patt_canvas.line_to(15, 15)
    patt_canvas.path_paint("fs")
    testlib.must_throw(doc.tiling_pattern_load,
                       "matrix=1, 0, 0, 1, 0, 0",
                       patt_canvas) # no step
    patt_id = doc.tiling_pattern_load("step=20, 20", patt_canvas)

    # use pattern
    doc.page_start(5.9*72, 3.5*72)
    writer = doc.page().canvas()
    writer.color_space_pattern_uncolored("f", jagpdf.CS_DEVICE_GRAY)
    writer.pattern("f", patt_id, .5)
    writer.rectangle(36, 36, 144, 144)
    writer.path_paint("sf")

    #try to write to pattern that is already registered
    patt_canvas.rectangle(7, 7, 6, 6)
    patt_canvas.path_paint("fs")
    writer.rectangle(36+144+4, 36, 144, 144)
    writer.path_paint("sf")

    doc.page_end()

    # !!!! suprising - try to write to pattern that is already outputted
    patt_canvas.circle(10, 10, 5)
    patt_canvas.path_paint("s")

    # !!!! this is wild -> causes abort
    #patt_canvas.paint("fs")

    doc.finalize()
Ejemplo n.º 29
0
def check_errors():
    doc = jagpdf.create_stream(testlib.NoopStreamOut())
    doc.page_start(1, 1)
    fn = function(doc, 'double_dot')
    sh = doc.shading_pattern_load(
        "function; matrix_fun=100, 0, 0, 100, 50, 50", jagpdf.CS_DEVICE_GRAY,
        fn)
    canvas = doc.page().canvas()
    canvas.color_space_pattern('fs')
    testlib.must_throw(canvas.pattern, 'fs', sh, 1)
    canvas.color_space_pattern_uncolored('fs', jagpdf.CS_DEVICE_GRAY)
    canvas.pattern('fs', sh)  # should throw
    # indexed not allowed pattern spaces
    indexed_cs = doc.color_space_load("adobe-rgb; palette=77, 179, 102")
    fn = doc.function_2_load("c0=1.0, 0.0, 0.0; c1=0.0, 0.0, 1.0")
    testlib.must_throw(doc.shading_pattern_load,
                       "axial; coords=50, 50, 150, 150", indexed_cs, fn)
    doc.page_end()
    doc.finalize()
Ejemplo n.º 30
0
def test_main(argv=None):
    #raw_input('.......')
    if argv == None:
        argv = sys.argv
    out_file = os.path.abspath(os.path.join(argv[1], 'pattern-nonstd-op.pdf'))
    cfg = testlib.test_config()
    doc = jagpdf.create_stream(testlib.FileStreamOut(out_file), cfg)

    patt_canvas = doc.canvas_create()
    testlib.must_throw(doc.tiling_pattern_load, "step=0, 0",
                       patt_canvas)  # empty canvas
    patt_canvas.move_to(5, 5)
    patt_canvas.line_to(15, 15)
    patt_canvas.path_paint("fs")
    testlib.must_throw(doc.tiling_pattern_load, "matrix=1, 0, 0, 1, 0, 0",
                       patt_canvas)  # no step
    patt_id = doc.tiling_pattern_load("step=20, 20", patt_canvas)

    # use pattern
    doc.page_start(5.9 * 72, 3.5 * 72)
    writer = doc.page().canvas()
    writer.color_space_pattern_uncolored("f", jagpdf.CS_DEVICE_GRAY)
    writer.pattern("f", patt_id, .5)
    writer.rectangle(36, 36, 144, 144)
    writer.path_paint("sf")

    #try to write to pattern that is already registered
    patt_canvas.rectangle(7, 7, 6, 6)
    patt_canvas.path_paint("fs")
    writer.rectangle(36 + 144 + 4, 36, 144, 144)
    writer.path_paint("sf")

    doc.page_end()

    # !!!! suprising - try to write to pattern that is already outputted
    patt_canvas.circle(10, 10, 5)
    patt_canvas.path_paint("s")

    # !!!! this is wild -> causes abort
    #patt_canvas.paint("fs")

    doc.finalize()
Ejemplo n.º 31
0
def test_main(argv=None):
    if None == argv:
        argv = sys.argv
    out_file = os.path.abspath(os.path.join(argv[1], 'config.pdf'))
    cfg_file = os.path.abspath(os.path.join(argv[1], 'config.ini'))
    doc = jagpdf.create_stream(testlib.FileStreamOut(out_file))
    doc = None
    doc = jagpdf.create_file(out_file)
    doc = None
    cfg = jagpdf.create_profile()
    cfg.set("doc.compressed", "blue-foundation")
    cfg.save_to_file(out_file)
    cfg_str = open(out_file).read()
    cfg3 = jagpdf.create_profile_from_file(out_file)
    cfg2 = jagpdf.create_profile_from_string(cfg_str)
    cfg3.save_to_file(cfg_file)
    cfg3_str = open(cfg_file).read()
    cfg2.save_to_file(cfg_file)
    cfg2_str = open(cfg_file).read()
    os.unlink(out_file)
    os.unlink(cfg_file)
    assert cfg3_str == cfg2_str
Ejemplo n.º 32
0
def test_main(argv=None):
    if None==argv:
        argv = sys.argv
    out_file = os.path.abspath(os.path.join(argv[1], 'config.pdf'))
    cfg_file = os.path.abspath(os.path.join(argv[1], 'config.ini'))
    doc = jagpdf.create_stream(testlib.FileStreamOut(out_file))
    doc = None
    doc = jagpdf.create_file(out_file)
    doc = None
    cfg = jagpdf.create_profile()
    cfg.set("doc.compressed", "blue-foundation")
    cfg.save_to_file(out_file)
    cfg_str = open(out_file).read()
    cfg3 = jagpdf.create_profile_from_file(out_file)
    cfg2 = jagpdf.create_profile_from_string(cfg_str)
    cfg3.save_to_file(cfg_file)
    cfg3_str = open(cfg_file).read()
    cfg2.save_to_file(cfg_file)
    cfg2_str = open(cfg_file).read()
    os.unlink(out_file)
    os.unlink(cfg_file)
    assert cfg3_str == cfg2_str
Ejemplo n.º 33
0
 def __init__(self, option, value):
     CreatorBase.__init__(self, option, value)
     self.doc = jagpdf.create_stream(testlib.NoopStreamOut(), self.profile)
Ejemplo n.º 34
0
def test_main(argv=None):
    doc = jagpdf.create_stream(NoopStreamOut())
    doc.finalize()
Ejemplo n.º 35
0
def test_main(argv=None):
    doc = jagpdf.create_stream(NoopStreamOut())
    doc.finalize()
Ejemplo n.º 36
0
 def __init__(self, option, value):
     CreatorBase.__init__(self, option, value)
     self.doc = jagpdf.create_stream(testlib.NoopStreamOut(), self.profile)