Is there a direct way to load Aspose Word Document into Aspose PDF Document without using MemoryStream

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

hadi:
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 ?
Hi Hadi,

Aspose.Pdf for .NET and Aspose.Words for .NET are two separate products and they have separate Document Object Model by which they handle the source files. Please note that Aspose.Pdf for .NET cannot directly load Word documents unless they are converted to PDF format. Consequently, Aspose.Words cannot directly load PDF documents unless they are first transformed to DOC or any other format supported by Aspose.Words.

In the event of any further query, please feel free to contact.