How to write pdf stream to pdf file?

var ostream = new MemoryStream();

oFinalDocument.Save(ostream, SaveFormat.Pdf);

return ostream.ToArray();

byte[] footNoteData = null;

byte[] footNoteData = ostream.ToArray();

--now how to write tht byte array to pdf file----here ostream is getting in byte

how to write pdf stream to pdf file?

var ostream = new MemoryStream();

oFinalDocument.Save(ostream, SaveFormat.Pdf);

return ostream.ToArray();

byte[] footNoteData = null;

byte[] footNoteData = ostream.ToArray();

--now how to write tht byte to pdf file----here ostream is getting in byte

how to write pdf stream to pdf file?

Hi

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);

}

Best regards,

yeah my question is how to write byte array to pdf file using aspose.pdf…not doc to pdf file stream

Hello

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.

Best regards,

Hi,

Thanks for using our products.

You can concatenate PDF documents to generate single resultant PDF. Please take a look over following link for required information on


In case I have not properly understood your requirement or you have any further query, please feel free to contact.

please go through given below sample once

var ostream = new MemoryStream();

oFinalDocument.Save(ostream, SaveFormat.Pdf);

return ostream.ToArray();

byte[] footNoteData = null;

byte[] footNoteData = ostream.ToArray();----how to write this byte to pdf file ?

now i have to write tht byte array------footNoteData information ------ to pdf file?

how to convert byte array to pdf using aspose.pdf?

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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.

Thank You & Best Regards,

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please see your other post for a reply regarding your query. Following is the link to the post.

If you still face any problem or need any assistance, please do let us know.

Thank You & Best Regards,

can u pls let me know..using aspose.pdf is it possible to write pdf stream to pdf file?

actually ur code shows tht with out using aspose.pdf........just using file stream we are doing ....

is it the right way to do using aspose?

iam trying to do using aspose.pdf....pls see my below code and pls modify how to write byte array to pdf file

Document srcdoc = new Document(@"C:\test.docx");//--current

var ostream = new MemoryStream();

srcdoc.Save(ostream, Aspose.Words.SaveFormat.Pdf);

byte[] data = ostream.ToArray();

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

MemoryStream postStream = new MemoryStream(data);

// pdf.BindHTML(postStream);---how to write byte array to pdf?

pdf.Save(@"c:\test.pdf");

iam trying to do using aspose.pdf....pls see my below code and pls modify how to write byte array to pdf file

Document srcdoc = new Document(@"C:\test.docx");//--current

var ostream = new MemoryStream();

srcdoc.Save(ostream, Aspose.Words.SaveFormat.Pdf);

byte[] data = ostream.ToArray();

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

MemoryStream postStream = new MemoryStream(data);

// pdf.BindHTML(postStream);---how to write byte array to pdf?

pdf.Save(@"c:\test.pdf");

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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 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 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.

Thank You & Best Regards,

Hi,

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.