Dear All,

I am puzzled why the putpdf command requires the output file name to have specifically the extension as ".pdf".

Consider the following example code:

Code:
    clear all
    version 16.1

    tempfile tmp
    putpdf begin
    putpdf paragraph
    putpdf text ("Hello, World!")
    putpdf save `"`tmp'"'

// end of file
When executed it ends with an error 198:
C:\Users\MYUSERNAME\AppData\Local\Temp\ST_79d8_000 001.tmp is not a pdf file


I have reported earlier a similar problem related to the images that I tried to include into the report, where Hua Peng (StataCorp) has provided a workaround and which was later confirmed fixed by Zhao Xu (StataCorp) .

Context: the report is created in PDF format, file is uploaded to a remote server with a proper name ending in ".pdf", then local copy is disposed of. I want to rely on Stata's tempfile facility to clean up the temporary file, which doesn't work in this case.

Can anyone please check if Stata 17 behaves the same and results in an error with the above-shown code?

I don't see any reason for a pdf-document to have a specific extension, just like we are creating temporary data files without bothering giving them the ".dta" extension. If anything, the current error message could be a warning for a novice user, but shouldn't be blocking, imho.

Thank you, Sergiy