Cannot view PDF successfully after file transfer via Powershell script
I have a powershell script that is used for transferring XML and PDF files. For both types of files, it performs the following operations separately:
1. Copies files (\*.pdf) from remote folder A to local folder X via session.GetFiles
2. Copies files (\*.pdf) from remote folder A to local folder TEMP via session.GetFiles. After copying, files in folder A are deleted (because the parameter remove is set to true)
3. Copies files (\*.pdf) from local folder TEMP to remote folder B via session.PutFiles. After copying, files in folder TEMP are deleted (because the parameter remove is set to true)
Same operation is performed for xml files, too. For both file types, I use the same TEMP folder.
Basically steps 2 and 3 combined perform a move operation (There is probably a better solution for this, I know, but it works for me for now.)
When I run the script, the files are transferred successfully without a problem. There is no problem with the XML's, but when I try to view the PDF files that are transferred, I get a blank page saying "There was an error processing a page. Invalid colorspace". I tried viewing on different browsers and in my local disk, but that did not help.
One of the things I am suspecting is, that the file format might be messed up during the transfer, possibly because of some parameter in GetFiles/PutFiles. I looked but could not find an answer. I would appreciate any suggestion as to why this might have happened.
1. Copies files (\*.pdf) from remote folder A to local folder X via session.GetFiles
2. Copies files (\*.pdf) from remote folder A to local folder TEMP via session.GetFiles. After copying, files in folder A are deleted (because the parameter remove is set to true)
3. Copies files (\*.pdf) from local folder TEMP to remote folder B via session.PutFiles. After copying, files in folder TEMP are deleted (because the parameter remove is set to true)
Same operation is performed for xml files, too. For both file types, I use the same TEMP folder.
Basically steps 2 and 3 combined perform a move operation (There is probably a better solution for this, I know, but it works for me for now.)
When I run the script, the files are transferred successfully without a problem. There is no problem with the XML's, but when I try to view the PDF files that are transferred, I get a blank page saying "There was an error processing a page. Invalid colorspace". I tried viewing on different browsers and in my local disk, but that did not help.
One of the things I am suspecting is, that the file format might be messed up during the transfer, possibly because of some parameter in GetFiles/PutFiles. I looked but could not find an answer. I would appreciate any suggestion as to why this might have happened.