1

I am working on developing an Event Receiver inside my SharePoint farm 2013. now inside my event receiver i am trying to do the following:-

  1. to copy a .xlsx file from a document library.
  2. add the file to another document library.
  3. convert the .xlsx file inside the destination library to PDF file.

here is my code to move the file from one library to another:-

SPDocumentLibrary template = (SPDocumentLibrary)properties.Web.GetList(properties.Web.ServerRelativeUrl + "/Templates/");
SPListItem templetefile = null;

foreach (SPListItem i in template.Items)
{
    if (i.Name.ToLower().Contains("project"))
    {
         templetefile = i;    
    }
}

byte[] fileBytes = templetefile.File.OpenBinary();
string destUrl = properties.Web.ServerRelativeUrl + "/" + projectid.RootFolder.Url +".xlsx";
SPFile destFile = projectid.RootFolder.Files.Add(destUrl, fileBytes, false);

but i am not sure if i can convert the .XLSX file to PDF ? is there any available libraries inside sharepoint server-side object module or inside C# which i can include inside my Event Receiver?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.