Hi,
The background of my objective can be found in the following thread :
https://forum.aspose.com/t/48620
Below is the code snippet of GenerateWordDocument method
public bool GenerateWordDoc(object activeCust)
{
Document d = _Execute(currentActiveCust.ActiveReportJob, custNo);
d.Save(tmpDoc, SaveFormat.Doc);
using (MemoryStream dstStream = new MemoryStream())
{
d.Save(dstStream, SaveFormat.Pdf);
Aspose.Pdf.Document pdfDocWithoutOMR = new Aspose.Pdf.Document(dstStream);
Aspose.Pdf.Document pdfDocWithOMR = DrawOMROnPDFUsingPdfFileStamp(pdfDocWithoutOMR);
pdfDocWithOMR.Save(currentActiveCust.ActiveReportJob.DOC_Directory + filename + ".pdf");
}
}
From the document, i cannot find the API to load Aspose Word document into Aspose PDF Document constructor. Alternatively we are forced to use MemoryStream. Is there a more efficient way or API to load the Aspose PDF document directly from Aspose word document ?
Because this code will be executed using Task Parallel Library, i suspect that the MemoryStream object is shared by multiple threads at the same time.
Task processIndividualCustPort = Task.Factory.StartNew(() =>
{
bool isProcessed = p.GenerateWordDoc(activeCust);
return isProcessed;
}
, cancellationSupport
);
So if there is a more efficient way without using MemoryStream, i will be happy to hear from you.
Regards,
hadi teo