Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Feb 14, 2017 11:38 am

Hi,

I'm investigating your Free Spire.Doc library for features, which it maintain.

I'm load .docx file and replace some strings in it.
After this I'm want to convert .docx to pdf without storing on local drive, is it possible to achieve?
Because right now I'm only found a method to directly store on hard drive this file.

document.SaveToFile("Test.pdf", FileFormat.Pdf);

Bob

testfreespire
 
Posts: 9
Joined: Mon Feb 13, 2017 8:28 am

Wed Feb 15, 2017 2:18 am

Dear Bob,

Thanks for your inquiry.
Please use Document.SaveToStream method.
If there is any question, please let me know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Feb 17, 2017 8:29 am

Hello,

Have you tried Document.SaveToStream method? Is it what you need?
Could you please give us some feedback at your earliest convenience?

Thanks,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2767
Joined: Wed Jun 27, 2012 8:50 am

Mon Feb 20, 2017 9:31 am

Good day,

Thank you for your answer.
I'm right now trying to call this method, but don't sure how is properly write to stream with this method, don't you have an example?

Bob

testfreespire
 
Posts: 9
Joined: Mon Feb 13, 2017 8:28 am

Mon Feb 20, 2017 9:55 am

Dear Bob,

Thanks for your inquiry.
Here is a sample for your reference.
Code: Select all
            using (MemoryStream ms = new MemoryStream())
            {
                doc.SaveToStream(ms,FileFormat.Docx);
            }

If there is any question, please feel free to contact us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Feb 20, 2017 10:11 am

thank you, will try this code.

testfreespire
 
Posts: 9
Joined: Mon Feb 13, 2017 8:28 am

Mon Feb 20, 2017 10:25 am

I have a problem: all works untill I'm try to save to stream. Don't know why, but it's save corrupted file. Please can you help me?

testfreespire
 
Posts: 9
Joined: Mon Feb 13, 2017 8:28 am

Mon Feb 20, 2017 11:05 am

fixed, everything is work. thank you

testfreespire
 
Posts: 9
Joined: Mon Feb 13, 2017 8:28 am

Tue Feb 21, 2017 1:30 am

Dear testfreespire,

Thanks for your feedback.
Please feel free to contact us if there is any question. We are here for help.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc