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()
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()
def __init__(self): self.pdf = PdfFile() self.pages = [] self.swfs = [] pass