Thanks for your inquiry. Please try using the following code:
Document doc = new Document("C:\\Temp\\in.doc");
string pdfFilePath = "C:\\Temp\\Test.pdf";
using (FileStream pdfFileStream = File.Create(pdfFilePath))
{
// Convert the Document to a Pdf file stream
doc.Save(pdfFileStream, SaveFormat.Pdf);
}
Thanks for your request. Your question is related to Aspose.Pdf. So, I will move it to the appropriate forum. My colleagues from Aspose.Pdf team will answer you shortly.
I think you can simply use FileStream class to write your byte array to a file. Please add the following code to write / create a new file from byte array.
// Open file for reading
System.IO.FileStream fileStream = new System.IO.FileStream("C:\\Test.Pdf", System.IO.FileMode.Create, System.IO.FileAccess.Write);
//Writes bytes to this stream using data from a byte array.
fileStream.Write(footNoteData, 0, footNoteData.Length);
// close file stream .
fileStream.Close();
Please check it and let us know if it fits your need.
We are not very clear about your requirement. Please provide us some further details about what you want to acquire. Now, as per my understanding from your post, if you want to convert a word document to PDF using Aspose.Words directly then you don’t need to save the document into a stream. You can directly save it to a PDF file on a physical location i.e. srcdoc.Save(@"c:\test.pdf", Aspose.Words.SaveFormat.Pdf);
Or, if you want to perform any manipulation / changes to the PDF document after conversion from a word document then you can use the FileStream (as code shared in my previous post). I think there is no issue in using FileStream for opening or saving files and it works perfectly fine with Aspose.Pdf.
Still, if you have any other query or requirement or my understanding regarding your requirement is not correct, please provide us some more details and we will get back to you.
Adding more to Nausherwan’s comments, do you mean you need to convert the word file into PDF format, then save it into Byte array and create MemorStream object from it. Finally merge it into existing PDF document. If so is the requirement, as I have shared earlier, you can use Aspose.Pdf for .NET to merge/concatenate PDF documents. Please share some details so we may answer accordingly. We apologize for your inconvenience.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.