The FileToPDF() method which is an API of Acrobat Distiller may not work properly. The FileToPDF() method is executed by VBA script of Microsoft Excel, and the source code is as follows.
----------VBA script start----------
Const m_strDistillerProgID = "pdfdistiller.pdfdistiller.1"
CreatePDF2 ActiveSheet.Range("D2").Value, ActiveSheet.Range("D3").Value
Function CreatePDF2(szPSFilePath As String, strFullPathOfPDFFile As String) As Boolean
Dim DistillerObj As Object
ActiveSheet.PrintOut copies:=1, PrToFileName:=szPSFilePath
Set DistillerObj = CreateObject(m_strDistillerProgID)
DistillerObj.FileToPDF szPSFilePath, strFullPathOfPDFFile, ""
Set DistillerObj = Nothing
----------VBA script end----------
Usually, the PDF file is created in the path in strFullPathOfPDFFile. (expected behavior)
However, if the VBA script is executed while printing another file with Adobe PDF, the PDF file is created in the path (including file name) of another file being printed. (unexpected behavior)
Would you teach me the cause and hot to deal with it?
When the PDF file is created in incorrect path, the Post Script file was created in correct path.
I confirmed this problem in Adobe Acrobat Pro DC (version 2015.006.30033) and 2017 (version 2017.011.30078).
Thank you for your consideration.
No part of the Acrobat SDK supports multi threading or multiple invocations. I believe this is noted in the Developer FAQ. You must not try to print two things at a time to PDF. Serialise.
Thank you for your reply.
I want to make an application which creates PDF automatically at an arbitrary timing.
Is there any way to prevent conflict by coding or setting?
The following is another question.
Some application have similar problems without conflicting.
Application A creates PDF and completes normally.
After that application B creates PDF but PDF is created with the path and name which are set for application A.
Do you know the cause?(e.g. some process is insufficient for application A.)
Serialize. If serialization not possible, forbid simultaneous execution. This is not for use in automated worlds.
I see that simultaneous execution is prohibited.
Do you know the cause of another problem?
Even if two applications are executed one by one, the same problem may occur.
Is there any insufficiency in the application executed first? (This application was developed by us.)
Or is there any way to avoid it in the application executed later?