Пример #1
0
class SwfPdf(object):

	def __init__(self):
		self.pdf = PdfFile()
		self.pages = []
		self.swfs = []
		pass

	#@profile
	def add_swf(self, swf_file):

		sxml = SwfXml(swf_file)
		self.pages.append(sxml.id)
		sxml.make(self.pdf)
		pass

	def write(self, fs):

		self.pdf.add_object(name="catalog", props=[
			PdfProp("Type", "/Catalog"),
			PdfProp("Pages", "<%pages%>")
		])
		self.pdf.add_object(name="pages", props=[
			PdfProp("Type", "/Pages"),
			PdfProp("Kids", "[{}]".format(" ".join(map(lambda x: "<%page-{}%>".format(x), self.pages)))),
			PdfProp("Count", "{}".format(len(self.pages)))
		])

		self.pdf.root = "catalog"

		self.pdf.write(fs)
		fs.flush()
Пример #2
0
class SwfPdf(object):
    def __init__(self):
        self.pdf = PdfFile()
        self.pages = []
        self.swfs = []
        pass

    #@profile
    def add_swf(self, swf_file):

        sxml = SwfXml(swf_file)
        self.pages.append(sxml.id)
        sxml.make(self.pdf)
        pass

    def write(self, fs):

        self.pdf.add_object(
            name="catalog",
            props=[PdfProp("Type", "/Catalog"),
                   PdfProp("Pages", "<%pages%>")])
        self.pdf.add_object(name="pages",
                            props=[
                                PdfProp("Type", "/Pages"),
                                PdfProp(
                                    "Kids", "[{}]".format(" ".join(
                                        map(lambda x: "<%page-{}%>".format(x),
                                            self.pages)))),
                                PdfProp("Count", "{}".format(len(self.pages)))
                            ])

        self.pdf.root = "catalog"

        self.pdf.write(fs)
        fs.flush()
Пример #3
0
	def __init__(self):
		self.pdf = PdfFile()
		self.pages = []
		self.swfs = []
		pass
Пример #4
0
 def __init__(self):
     self.pdf = PdfFile()
     self.pages = []
     self.swfs = []
     pass