def test(): doc = Document() section = Section('Multirow Test') figure = Figure() image_filename = os.path.join(os.path.dirname(__file__), '../examples/kitten.jpg') figure.add_image(image_filename) figure.add_caption('Whoooo an imagage of a pdf') section.append(figure) doc.append(section) doc.generate_pdf()
def add_figure(self,file=None,caption=None,width='240px'): '''添加图片 :param str file: 图片文件 :param str caption: 图片标题 :param str width: 图片宽度 :return: 无返回值 ''' graph = Figure(position='h!') #graph = Figure() graph.add_image(file, width=width) if caption is not None: graph.add_caption(caption) self.content.append(graph)
#!/usr/bin/env python from pylatex import Document, Section from pylatex.graphics import Figure doc = Document() section = Section("Multirow Test") figure = Figure() figure.add_image("docs/static/screenshot.png") figure.add_caption("Whoooo an imagage of a pdf") section.append(figure) doc.append(section) doc.generate_pdf()
#!/usr/bin/env python from pylatex import Document, Section from pylatex.graphics import Figure doc = Document() section = Section('Multirow Test') figure = Figure() figure.add_image('docs/static/screenshot.png') figure.add_caption('Whoooo an imagage of a pdf') section.append(figure) doc.append(section) doc.generate_pdf()
def addFigure(self,file=None,caption=None,width='240px'): graph = Figure(position='h!') graph.add_image(file, width=width) if caption is not None: graph.add_caption(caption) self.content.append(graph)