예제 #1
0
def pdf(request):
    try:
        obf = request.GET.get("o", 0)
        items = request.GET.get("items", None)
        gtc = request.GET.get("gtc", None)
        if not gtc and items:
            return HttpResponse("You must include both 'items' and 'gtc' in your get params.")
        if obf:
            items = deobfuscate(items, settings.OBFUSCATE_KEY)
            gtc = deobfuscate(gtc, settings.OBFUSCATE_KEY)
        items = items.split(",")
        owner = request.GET.get("owner", None)
        fname = pdflatex(items, gtc, owner=owner)
        if fname:
            data = open(fname, "r").read()
            response = HttpResponse(data, content_type="application/pdf")
            response["Content-Disposition"] = 'inline; filename="consortium.pdf"'
            return response
        else:
            return HttpResponse("Something went wrong there!")
    except Exception as e:
        buf = StringIO()
        print_exc(e, file=buf)
        return HttpResponse("Whoops! %s" % buf.getvalue())
예제 #2
0
def pdf(invoice):
    # TODO
    return latex.pdflatex(invoice)
예제 #3
0
파일: base.py 프로젝트: k7hoven/spexcript
        
        assert False # should never reach here (parent should contain self)
    
    def __repr__(self):
        return self.generate_text()


def read_spex_file(filename):
    with open(filename, "r", encoding = 'utf8') as f:
        spexcript = load_spexcript(f)
    return spexcript # the spex itself

if __name__ == "__main__":
    import sys
    spex = read_spex_file(sys.argv[1])
    from language import Finnish
    from latex import Spextex
    spextex = Spextex(Finnish)
    spex.generate_front_page(spextex)
    spex.generate_characters(spextex)
    spex.generate_listing(spextex)
    spex.generate_script(spextex)
    tex = spextex.final_result()
    import latex
    latex.pdflatex(tex)
    latex.show()    
    
#    txt = spex.generate_text()
#   with open("output.txt","w") as f:
#       f.write(txt.encode("utf8"))