cognidox / OfficeToPDF

A command line tool to convert Microsoft Office documents to PDFs
https://www.cognidox.com/
Other
610 stars 137 forks source link

Add an option filename NameOfFile #31

Open ptar opened 5 years ago

ptar commented 5 years ago

In an automated environment, OfficeToPDF might be used on file copies in a temporary folder using unique filenames which differ from the original file name. This breaks e.g. the Word field FILENAME or Excels Header and Footer options if they contain the filename.

Please add a new command line switch /filename NameOfFile which sets the internal filename after opening the file, or at least make it look like this.

In WordConverter.cs, there's already a special handling for filename fields, which might be easy to adapt.

I'm not sure if there's such an easy solution for Excel and the other Office programs.

Thanks in advance for implementing this!

Note: If my other issue about preventing field updates is implemented, the Word FILENAME field should be updated, before the field is unlinked!

vittala commented 5 years ago

Hi

We'll consider this, though we can't give a timeframe.

In your automated environment - can you place the temporary files in a uniquely named temporary folder with the appropriate file name. That would ensure that filenames get converted correctly, but still ensure the files being processed are uniquely named and un-guessable in advance.

Regards Vittal

ptar commented 5 years ago

Hi Vittal, thanks for considering this! We are currently checking if and how the we can change the creation and deletion of temporary files with uniquely named subfolders in the automated environment. Nevertheless, in Word, we would have to add some special handling for the filename fields, because we have this issue about preventing field updates, but the filename fields have to be updated, because they might not fit the current filename of the file. This is at least (and then always) the case, if you use SaveAs in Word or rename a Word-Document externally. bye Peter