Error fix for "There was an error opening this document. This file cannot be found" when attempting to open PDF files from Adobe Acrobat using the Start Process activity?
Description: When attempting to open PDF files from Adobe Acrobat using the Start Process activity, encounter an error message stating, "There was an error opening this document. This file cannot be found." This KB article provides a solution that offers a more robust and permanent fix to this issue.
Resolution: To overcome the error and successfully open PDF files from UiPath Studio, follow the steps outlined below,
- Import the necessary namespace
- Import the namespace "System.Diagnostics" to gain access to the Process class, which will be used in the solution.
- Create a variable and assign it to Process.Start()
- Create a variable, let's call it "X," with the datatype System.Diagnostics.Process
- Add an Assign activity in UiPath Studio
- Assign the value of variable X to Process.Start("Your File Path")
- (Replace "Your File Path" with the actual file path of the PDF file you wish to open.)
Example:
- Create a variable "X" of type System.Diagnostics.Process
- Add an Assign activity and assign X with the value Process.Start("C:\Path\to\your\file.pdf")
- (Replace "C:\Path\to\your\file.pdf" with the actual file path of the PDF file required to be opened)
Note: Other extension files can be used for the same function like txt, xls, slxs, etc.
Explanation:
By utilizing the Process class from the System.Diagnostics namespace, open PDF files in a more robust manner. This approach directly launches the specified file using the default associated application, such as Adobe Acrobat, ensuring a reliable and consistent opening process.
The Process.Start() method initiates the opening of the specified file. By assigning this method to the variable "X," it is possible to control the process and handle any exceptions or errors that may occur during the opening operation.
Additional Information: