|
|
@ -304,6 +304,7 @@ def get_file(): |
|
|
|
|
|
|
|
###### SCORE FIST PAGE |
|
|
|
globalname = "Pushing scores" |
|
|
|
print(tadam) |
|
|
|
|
|
|
|
scorefirstpage = '''<!DOCTYPE html> |
|
|
|
<html> |
|
|
@ -313,13 +314,15 @@ def get_file(): |
|
|
|
</head> |
|
|
|
<body> |
|
|
|
<style> |
|
|
|
body{background-color:yellow;} |
|
|
|
body{background-color:magenta;} |
|
|
|
</style> |
|
|
|
<div id="coverpage"> |
|
|
|
<div>'''+globalname+'''</div> |
|
|
|
<div>'''+str(scorenumber)+'''</div> |
|
|
|
<div>'''+str(clickongetfiletime)+'''</div> |
|
|
|
<div>'''+userip+'''</div> |
|
|
|
<div class="infos scorenumber">SCORE #'''+str(scorenumber)+'''</div> |
|
|
|
<div class="infos author">By '''+userip+'''</div> |
|
|
|
<!--<div class="infos globalname">Part of the Pushing Scores series</div>--> |
|
|
|
<div class="infos publisher">Part of the <i>Pushing Scores</i> series<br> |
|
|
|
Published and distributed by <img src="static/logo/logo.png"></div> |
|
|
|
<div class="infos time">On '''+str(clickongetfiletime)+'''</div> |
|
|
|
</div> |
|
|
|
</body> |
|
|
|
</html> |
|
|
@ -341,13 +344,13 @@ def get_file(): |
|
|
|
|
|
|
|
############# GENERATE SCORE PDF |
|
|
|
|
|
|
|
pathnamefilepdf = "pandoc/"+uniquename+"test.pdf" |
|
|
|
pathnamefilepdf = "scores/"+uniquename+"test.pdf" |
|
|
|
font_config = FontConfiguration() |
|
|
|
HTML(string=scorecontentpage, base_url='./').write_pdf(pathnamefilepdf, stylesheets=[CSS('static/css/stylepandoc.css', font_config=font_config)], font_config=font_config) |
|
|
|
|
|
|
|
############# GENERATE FIRST PAGE PDF |
|
|
|
|
|
|
|
pathnamefilecoverpdf = "pandoc/"+uniquename+"testcover.pdf" |
|
|
|
pathnamefilecoverpdf = "scores/"+uniquename+"testcover.pdf" |
|
|
|
font_config = FontConfiguration() |
|
|
|
HTML(string=scorefirstpage, base_url='./').write_pdf(pathnamefilecoverpdf, stylesheets=[CSS('static/css/stylepandoc.css', font_config=font_config)], font_config=font_config) |
|
|
|
|
|
|
@ -363,7 +366,7 @@ def get_file(): |
|
|
|
pdf1_pages = pdf1.getNumPages() |
|
|
|
pdf2_pages = pdf2.getNumPages() |
|
|
|
|
|
|
|
outputfile = open("pandoc/"+uniquename+"document-output.pdf", "wb") |
|
|
|
outputfile = open("scores/"+uniquename+".pdf", "wb") |
|
|
|
writer = PyPDF2.PdfFileWriter() |
|
|
|
|
|
|
|
for i in range(pdf1_pages): |
|
|
@ -379,9 +382,12 @@ def get_file(): |
|
|
|
outputfile.close() |
|
|
|
|
|
|
|
clearSession() |
|
|
|
os.remove(pathnamefilecoverpdf) |
|
|
|
os.remove(pathnamefilepdf) |
|
|
|
print("files removed") |
|
|
|
|
|
|
|
try: |
|
|
|
return send_file("pandoc/"+uniquename+"document-output.pdf", attachment_filename="olala.pdf") |
|
|
|
return send_file("scores/"+uniquename+".pdf", attachment_filename="olala.pdf") |
|
|
|
except Exception as e: |
|
|
|
return str(e) |
|
|
|
|
|
|
|