Retrieve used Filename for PrintJob using COM Interface

Hello,

i recently discovered, that if i use .ConvertTo("C:\PDF\MyFileName.pdf"), the file MyFileName.pdf already exists, PDFCreator-COM (recent Version 3.5.1) generates a new FileName like C:\PDF\MyFileName_2.pdf

How do i know which Filename was used to Convert when using the COM Interface?
I didn't found any hint on how to get the FileName. My current PrintJob do not provide this Information.

Hoping for some good Clues and Help from the Community and/or the Dev-Team.

Thanks in advance

Hi,

I think your best option is to check if the file already exists before converting and then handle it as required by your workflow e.g. rename the existing file to filename_backup.pdf, delete it, or chose not to convert.

Best regards

Robin

Hello Robin,

the problem is, that the COM Interface is creating a new Filename that i don't know at the time of executing.

for Example:

string myfilename = "C:\PDF\MyPDFFile.pdf";
...
JobQueue.ConvertTo(myfilename)

i expect that the PDFCreator COM Interface is creating the file C:\PDF\MyPDFFile.pdf. If the file doesn't exist it works as intended. But if the File already exists, it will create a file C:\PDF\MyPDFFile_2.pdf

This new Filename which will be created by the COM Interface when the input filename is already existing must be populated back by the Interface, so i can check "which filename do i get after the ConvertTo-Execution". After that i can populate the new Filename back in my function to next steps in my program.

Hi,

I understand that, and the solution is to check if the file already exists in that path before converting.
Then you can either replace the file by first deleting the existing file, select the new filename yourself or move the old file to a backup folder, as it suits you best.

E.g. in pseudocode:
string myfilename = "C:\PDF\MyPDFFile.pdf";
if file.exists(myfilename)
{myfilename = myfilename + "date.time"}
JobQueue.ConvertTo(myfilename)

However, I am not sure if the default behavior for PDFCreator shouldn't be to overwrite the file when using the COM interface, I will check with the rest of the team if this is intentional or a bug.
In the GUI there is a setting to chose between overwriting and renaming, but since you can handle everything in a customized manner through the COM interface, this setting isn't available there.

Best regards

Robin