We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words convert Word to PDF problem in CRM Online

Hi, am trying to get this scenario to work:
Environment: CRM 2016 online.
1) Compiled aspose.words dll into custom workflow activity. The code takes attachment in notes and converts into pdf, in memory.

byte[] fileContent = Convert.FromBase64String(d["documentbody"].ToString());
Stream stream = new MemoryStream(fileContent);
Aspose.Words.Document doc = new Aspose.Words.Document(stream);
MemoryStream dstStream = new MemoryStream();
doc.Save(dstStream, Aspose.Words.SaveFormat.Pdf);

2) Registered custom workflow in CRM2016 online.
3) I put this into a workflow, and run.
The following error comes up on the workflow step:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

When debugging it is erroring on the save. Is it trying to load true type fonts, and being online, there is no access to font directory? (I have tried embedding the fonts onto the word doc, but no success.)
Is it actually possible to get pdf conversion to work with CRM 2016 online?

Hi Tom,


Thanks for your inquiry. This is very possible that the exception is raised during an attempt to read fonts from system folders so that Aspose.Words can properly convert Word to PDF. Do you see this exception with one particular Word document or every Word document you try to convert to PDF cause the same exception? Are you able to perform DOCX to DOCX conversion? Can you please try specifying custom true type fonts location (the folder where your application/program has read/write permissions)?
How to Specify True Type Fonts Location

Best regards,
Hi, it happens with every document.

CRM online prohibits a plugin or a custom workflow from accessing the file system, so it is simply not possible if Aspose dll is trying to read a file (any file) from the file system.

I have abandoned this method and moving the code out of custom workflow.

Tom

Hi Tom,


In case you have further inquiries about Aspose.Words or need any help, please let us know.

Best regards,