Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

rbylnz

Re: Cannot view PDF successfully after file transfer via Powershell script

I figured out the problem. The file format was indeed being messed up during transfer. I solved to problem by changing the TransferMode (in the TransferOptions parameter) from Ascii" to Automatic. The script works perfectly now.
martin

Re: Cannot view PDF successfully after file transfer via Powershell script

Can you isolate the problem better? There are so many steps in your description. And I guess that most of them are actually irrelevant to the problem.
Do you get the same problem by simply downloading and re-uploading a single PDF file? Can you post a log file for that? Do you get the same problem, if you download and re-upload a single PDF file in WinSCP GUI?
rbylnz

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.