Save as PDF macro
Posted: 2017-03-28 12:48:49
I am trying to write a macro to export the active document to pdf. Nothing fancy, just the equivalent of the Menu command File:Export as PDF... I just want it to export the pdf file in the same folder where the rtf file is, and with the same name (and pdf extension of course).
Whatever I do, my simple macro creates the pdf file in the place of the original rtf file. That is, the rtf file gets replaced by the pdf, while keeping the same rtf extension. When in fact I expect the command Save as PDF to create the pdf as another file next to the rtf file that gets converted.
I am doing things like :
$doc = Document.active
$outputDir=$doc.filePath.filePathByRemovingLastComponent & '/'
Save as PDF $outputDir
and variations on the above, all without success.
Can somebody help ?
Many thanks.
Whatever I do, my simple macro creates the pdf file in the place of the original rtf file. That is, the rtf file gets replaced by the pdf, while keeping the same rtf extension. When in fact I expect the command Save as PDF to create the pdf as another file next to the rtf file that gets converted.
I am doing things like :
$doc = Document.active
$outputDir=$doc.filePath.filePathByRemovingLastComponent & '/'
Save as PDF $outputDir
and variations on the above, all without success.
Can somebody help ?
Many thanks.