예제 #1
0
def offprintfile_up(filename):
    filename = secure_filename(filename)
    file = os.path.join(UPLOADDIR, filename)

    pdf = convert(file,typ="local")

    r = Response(pdf)
    r.headers["content-type"] = "application/pdf"
    r.headers["content-disposition"] = "attachment;filename=" + filename
    r.headers["content-length"] = len(pdf)
    return r
예제 #2
0
def markdownfile_up(filename,layout):
    filename = secure_filename(filename)
    file = os.path.join(UPLOADDIR, filename)

    pdf = convert(file,layout=layout,typ="local",offprint=False)

    fn = os.path.basename(filename)
    (fn,ext) = os.path.splitext(filename)
    fn = fn + "-2x1.pdf"

    r = Response(pdf)
    r.headers["content-type"] = "application/pdf"
    r.headers["content-disposition"] = "attachment;filename=" + fn
    r.headers["content-length"] = len(pdf)
    return r
예제 #3
0
def offprinturl():
    url = None
    try:
        url = request.form["url"]
    except:
        url = request.args["url"]

    m=re.search("review.cfm\?id=(\d*)",url)
    if m:
        filename = "offprint-%s.pdf" % m.group(1)
    else:
        filename = "offprint.pdf"

    pdf = convert(url)

    r = Response(pdf)
    r.headers["content-type"] = "application/pdf"
    r.headers["content-disposition"] = "attachment;filename=" + filename
    r.headers["content-length"] = len(pdf)
    return r