code
โค้ด: เลือกทั้งหมด
if request.method == 'POST':
name = request.form['filename']
des = request.form['description']
code = request.form['rml']
print code
try:
with open(code) as rml:
data = rml.read()
pdf = rml2pdf.parseString(data.decode('utf-8'))
with open('code.pdf', 'w') as output:
output.write(pdf.read())
except:
print('แปลงไฟล์ผิดพลาด')
127.0.0.1 - - [25/May/2019 16:31:20] "GET / HTTP/1.1" 200 -
<!DOCTYPE document SYSTEM "rml.dtd">
<document filename="example1.pdf">
<template>
<!--this section contains elements of the document -->
<!--which are FIXED into position. -->
<pageTemplate id="main">
<frame id="first" x1="100" y1="400" width="150" height="200"/>
</pageTemplate>
</template>
<stylesheet>
</stylesheet>
<story>
<para>
Welcome to RML!
</para>
</story>
</document>
แปลงไฟล์ผิดพลาด