Ejemplo n.º 1
0
def save(doc, file, filename, options = {}):
	app.updateInfo(inf1=_('Postscript generation.'),inf2=_('Start document composing'),inf3=3)
	
	bbox = doc.BoundingRect(visible = 0, printable = 1)
	dev = PostScriptDevice
	ps_dev = dev(file, as_eps = 1, bounding_box = tuple(bbox),
					rotate = 0, # page rotate?
					For = system.get_real_username(),
					CreationDate = system.current_date(), Title = 'generated by sK1',
					document = doc)
	doc.Draw(ps_dev)
	ps_dev.Close()
	
	app.updateInfo(inf2=_('Document generation is finished'),inf3=100)
Ejemplo n.º 2
0
def save(doc, file, filename, options={}):
    app.updateInfo(inf1=_('Postscript generation.'),
                   inf2=_('Start document composing'),
                   inf3=3)

    bbox = doc.BoundingRect(visible=0, printable=1)
    dev = PostScriptDevice
    ps_dev = dev(
        file,
        as_eps=1,
        bounding_box=tuple(bbox),
        rotate=0,  # page rotate?
        For=system.get_real_username(),
        CreationDate=system.current_date(),
        Title='generated by sK1',
        document=doc)
    doc.Draw(ps_dev)
    ps_dev.Close()

    app.updateInfo(inf2=_('Document generation is finished'), inf3=100)
    align_distance = 6
    align_length = 12
    grow = align_length + align_distance
    llx, lly, urx, ury = doc_bbox
    ps_bbox = (llx - grow, lly - grow, urx + grow, ury + grow)
    for color in colors:
        separator = CreateSeparation(color)
        try:
            # do this in a try-finall to make sure the document colors
            # get restored even if something goes wrong
            doc.WalkHierarchy(separator.change_color)
            filename = basename + '-' + hexcolor(color) + '.ps'
            ps_dev = PostScriptDevice(filename,
                                      as_eps=1,
                                      bounding_box=ps_bbox,
                                      For=system.get_real_username(),
                                      CreationDate=system.current_date(),
                                      Title=os.path.basename(filename),
                                      document=doc)
            doc.Draw(ps_dev)
            draw_alignment_marks(ps_dev, doc_bbox, align_length,
                                 align_distance)
            ps_dev.Close()
        finally:
            separator.undo_changes()


import app.Scripting
app.Scripting.AddFunction('simple_separation',
                          _("Simple Separation"),
                          simple_separation,
Ejemplo n.º 4
0
	# alignment marks
	align_distance = 6
	align_length = 12
	grow = align_length + align_distance
	llx, lly, urx, ury = doc_bbox
	ps_bbox = (llx - grow, lly - grow, urx + grow, ury + grow)
	for color in colors:
		separator = CreateSeparation(color)
		try:
			# do this in a try-finall to make sure the document colors
			# get restored even if something goes wrong
			doc.WalkHierarchy(separator.change_color)
			filename = basename + '-' + hexcolor(color)  + '.ps'
			ps_dev = PostScriptDevice(filename, as_eps = 1,
										bounding_box = ps_bbox,
										For = system.get_real_username(),
										CreationDate = system.current_date(),
										Title = os.path.basename(filename),
										document = doc)
			doc.Draw(ps_dev)
			draw_alignment_marks(ps_dev, doc_bbox,
									align_length, align_distance)
			ps_dev.Close()
		finally:
			separator.undo_changes()


import app.Scripting        
app.Scripting.AddFunction('simple_separation',
								_("Simple Separation"),
								simple_separation,