I am looking to save a PDF to a file location without a user prompt. When Adding .pdf to the end of file
error occurs. Is there a solution or way of changing so it saves the file as a pdf?
Using
reportBytes = system.report.executeReport(path=‘ReprotName’,project=‘ProjectName’,
fileType=‘pdf’)
To make PDF file.
I was able to do so using system.file.writeFile(filePath + fileNmae,reportBytes) then
I found that it was writing to a text file. When I added a file extension of .pdf it gave
me the below error. Without the PDF extension it has no error and creates the file.
IOError: File ‘\serv\folder1\folder2\filename.pdf’ doesn’t exist or isn’t a file.
If you prefix the string literal with r, you don’t need quite as much escaping (although Python won’t allow a string to end in backslashes without slight hurdles); that is, these two both create the exact same string:
a = "\\\\\\serv\\dir1\\dir2\\"
b = r'\\\serv\dir1\dir2' + '\\'