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.

Wed Aug 10, 2022 1:09 am

Hi ,

We are exploring options to convert docx file stored in DB as base64 content to PDF
The file content needs to be consumed as a base64encoded string and the output is expected to be a bytestream or base64encoded stream

I see examples of spire.doc for such usecase but they all are reading and writing to file location

Does Spire.doc support converting base64encoded stream to pdf byte stream/base64encoded stream if so are there any sample of the same logic available

kureshsurury
 
Posts: 1
Joined: Wed Aug 10, 2022 12:52 am

Wed Aug 10, 2022 6:10 am

Hi,

Thank you for your inquiry.
Our Spire.Doc can achieve your requirement, please refer to the code below. If you have any questions, please feel free to contact me.
Code: Select all
            MemoryStream ms = new MemoryStream(Convert.FromBase64String(base64String));
            Document doc = new Document();
            doc.LoadFromStream(ms,FileFormat.Docx);
            MemoryStream outstream = new MemoryStream();
            doc.SaveToStream(outstream, FileFormat.PDF);

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Wed Oct 19, 2022 3:57 am

Hi,

Greetings from E-iceblue!
Did my code fix your issue? I would appreciate it much if you can give me some feedback at your convenience.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Return to Spire.Doc