I wrote the following code to concatinate two pdf files in Sharepoint document library.
private static MemoryStream OutStream;
private static MemoryStream[] ArrayStreams;
private static List Instreams;//I have memory streams of files in this list.
OutStream = new MemoryStream();
//Convert the stream list into array
ArrayStreams = Instreams.ToArray();
//Declares PdfFileEditor object to merge the streams
PdfFileEditor pdfEditor = new PdfFileEditor();
pdfEditor.Concatenate(ArrayStreams, OutStream);
This code works fine,when the signed in user is administrator.But the last line
pdfEditor.Concatenate(ArrayStreams, OutStream);
is not working when the user has read only permission on Sharepoint libray.I is returning Outstream as NULL.
So there is a problem with this Concatenate method.
Kindly review it.
Hi Surendrababu,
I would like to share with you that Concatenate method has to write some temporary files on the disk; however, if the application is running under a user which doesn’t have enough permissions, this kind of issue might occur.
In order to overcome this issue, I would suggest that you create a temporary folder on your disk drive and assign its path to TempPath property of Settings
class. You also need to assign full rights, on this folder, to the user
your application is running under. You can find this new property in the latest version.
You may also set AllowConcatenateExceptions property of the PdfFileEditor class to true, so that you’ll be able to catch any exceptions in the Concatenate method.
I hope this helps. If you still find any issues or have more questions, please do let us know.
Regards,
Hi Shahzad
Thank you for the response.Since we are working with SharePoint libraries,which path should we give for the temporary files.Since the user has read only permission on the library,we can’t give that permission.Its not in the scope of out application that we are developing.
Please specify a solution for this problem of TempPath…Please share some code snippets or examples regarding the TempPath.
Thanking you very much.
With Regards
Surendrababu J
Hi Surendrababu,
In order to set the temp path, you don’t need to specify a path to the Sharepoint library, rather some folder on your hard disk as shown below:
Settings.TempPath = @“c:\tempfolder”;
Also, please make sure that you allow write permission, on this folder, to the user the Sharepoint services are running under.
I hope this helps. If you find any further questions, please do let us know.
Regards,