human
How to base64 encode a PDF file in Python
assistant
Here is some code to encode a pdf file `pdf_reference.pdf` with `base64` encoding

a = open('pdf_reference.pdf', 'rb').read().encode('base64')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.