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

Free Support Forum - aspose.com

Problem with Aspose Words / Aspose PDF - Attempted To Read or Write Protected Memory

we are currently getting the error ‘Attempted to Read or Write Protected Memory - this is often an indication of other memory that is corrupt’ when calling the Pdf Save method e.g.
pdf.save(docName, Aspose.Pdf.SaveType.OpenInAcrobat, this.Response)
We are loading word template pages into Aspose.Words and then saving the merged document out into PDF format. We have upgraded Aspose.words to version as a lot of people on the forums are saying this cures this problem, but unfortunately this has not cured our problem.
We have already tried the following :-
Upgraded our Aspose.Words dll to version 5.0.0 as per the various discussions we have been reading on the aspose forums.
Registered the Aspose.words and Aspose.PDF.dll in GAC
Granted read and write permissions on each of the dll’s
The Code snippet can where the problems are occuring can be found below :-

private void SendToBrowserAsPdf(Document doc, string documentprinted, string docName, string internalname)
    MemoryStream stream = new MemoryStream();
    doc.Save(stream, SaveFormat.AsposePdf);
    stream.Seek(0, SeekOrigin.Begin);
    XmlDocument xmlDoc = new XmlDocument();
    string pdflicensefile = MapPath(@"..\bin\Aspose.Pdf.lic");
    if (System.IO.File.Exists(pdflicensefile))
        Aspose.Pdf.License pdflic = new Aspose.Pdf.License();
    Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
    pdf.IsImagesInXmlDeleteNeeded = true;
    pdf.BindXML(xmlDoc, null);
    pdf.IsTruetypeFontMapCached = false;
        pdf.Save(docName, Aspose.Pdf.SaveType.OpenInAcrobat, this.Response); // THIS IS WHERE THE ERROR IS GENERATED! 
    catch (Exception ex_)

Any help would be much appreciated,

Thanks for your request. Please make sure that your application uses Aspose.Words v5.0.0. Most probably your application uses old version.
Also I would like to advice you to upgrade to the latest versions of Aspose.Words and Aspose.Pdf.
Best regards.