Convert to/from stream


I’m investigating to use PDFTron to handle file conversions and have some questions. I’m working with dotnet core using C#. Currently the way our system is setup is that we get a Stream as input and want to save a pdf back to a Stream.

For normal pdfs I noticed new PDFDoc() accepts a Stream and in PDFDoc.Save() I can also give a Stream, which is exactly what I need.
The problem I’m having is with other file types. For example when I have an office file I use pdftron.PDF.Convert.OfficeToPDF(), but this one only accepts a string that points to a file somewhere on disk instead of a Stream.
Same with PDFDraw(), it has a function called Export(), but I cannot find a way to use it to output it as a Stream the same way PDFDoc.Save() can.

Is this possible with pdftron?

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:



It is possible to convert office files from a stream/filter. Instead of the method that takes a string to a filepath, we also offer an API that takes a filter. Please see the link here for the OfficeToPDF API.

In addition, PDFDraw has a GetBitmap method, that exports the image into a Bitmap that you can save in memory.

Please let me know if this works for you, and if you have any further questions.

Hi shakthi124,

Thanks for your reply, I’ve managed to get everything working the way I wanted.

I am gonna export doc to pdf.
So my case is
user edited docx file and saves it.
I wanted to save it as office file but pdftron doesn’t support it.
so I am gonna save this to pdf. but how to do this?
could you share your experience pelase?


If you are looking to convert Word files to PDF, you can use our SDK to do so. Please refer to the following sample code for more information.

If however you are looking to go the other way (ie. to convert PDF files to Word), our SDK can do that as well. Please see the code here.

I am gonna do by using web viewer on frontend side.
on React.js Project.

Please refer to the WebViewer startup documentation for more information.

If you would like to save the resulting PDF to Word however, you will need a back-end for this process. We support a wide variety of languages. Take a look at the following documentation for more information.