The function I provided above works fine, we just need to forced the script to save the changes by calling the saveAndClose() method before calling the function that converts the doc into PDF.
The function I provided above works fine, we just need to forced the script to save the changes by calling the saveAndClose() method before calling the function that converts the doc into PDF.