Skip to content

SftpFileStream.Write() corrupt PDF files #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bgillet opened this issue Dec 6, 2016 · 4 comments
Closed

SftpFileStream.Write() corrupt PDF files #124

bgillet opened this issue Dec 6, 2016 · 4 comments

Comments

@bgillet
Copy link

bgillet commented Dec 6, 2016

Hi !

I am using latest stable version of the library (2016.0.0).

When I use SftpClient.OpenWrite() method to create a file on SFTP server, I get an SftpFileStream where writing to.

When I write into this stream data from a valid PDF file, I get a "valid" PDF file on SFTP server. When I say "valid" it is not really true. PDF file has same size as original file and can be opened. But, in fact, the PDF file is not valid because images inside the document have been corrupted while text content is still correct.

Partial screenshot of original generated PDF :
image

Partial screenshot of corrupted copied PDF :
image

Here is a comparaison of file content :
image

It looks like beginning of PDF is written again in destination file. It looks like a buffer problem.

Problem is solved when setting a buffer size (ex: 1024) to the stream's CopyTo() method.

@h7web
Copy link

h7web commented Dec 9, 2016

Do you know where a simple example of using this library might be found? I am new to this library and am not finding any documentation to tell me how to use it. Thanks!

@drieseng
Copy link
Member

This should be fixed in version 2016.1.0-beta1.
Please test and provide feedback.

@BobLokerse
Copy link

As in #116 , I can confirm that it fixed my similar problem.

Is there an expectation date when this fix will come out of beta?

@drieseng
Copy link
Member

Duplicate of issue #70.

A new beta will be available soon, and final release shortly after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants