Bottle functions aren't supposed to return the response
object, they're supposed to return an iterable (string, list, generator, etc.).
So you want this:
from io import BytesIO
from reportlab.pdfgen import canvas
@bottle.route('/pd')
def create_pdf():
response.headers['Content-Type'] = 'application/pdf; charset=UTF-8'
response.headers['Content-Disposition'] = 'attachment; filename="test.pdf"'
buffer = BytesIO()
p = canvas.Canvas(buffer)
p.drawString(100,100,'Hello World')
p.showPage()
p.save()
return buffer.getvalue()