Convert from Word to PDF

2 posts, 0 answers
  1. grenadejumper
    grenadejumper avatar
    1 posts
    Member since:
    Nov 2015

    Posted 25 Nov 2015 Link to this post


    I am trying to convert docx-files to pdf-files using DocxFormatProvider to import the files, and using PdfFormatProvider to export the files. This works fine in most cases, but it seems that images that are not inline are missing from the generated pdf-file.

    If I have a word-file with 2 images and some text. One image is inline, another is not (lets say it has the text-wrap setting to "square"). I import the docx-file to a RadFlowDocument. The inline image gets detected in the RadFlowDocument as ImageInLine, while the image with text-wrap gets detected as FloatingImage. In the end I export as PDF and save it locally. When I open the PDF, only text and the inline image is showing, the floating (text-wrapped) image is gone.

    Is there a way to keep all images when converting from docx to pdf?

    Here is a snippet of my code:
    var providerDocx = new DocxFormatProvider();
    var document = providerDocx.Import(inStream); //inStream is read from a docx file earlier
    var providerPdf = new PdfFormatProvider();
    Stream outStream = new MemoryStream();
    providerPdf.Export(document, outStream);
    //Test the conversion:
    var fileStream = File.Create("PdfTest.pdf");
    outStream.Seek(0, SeekOrigin.Begin);
  2. Tanya
    Tanya avatar
    584 posts

    Posted 27 Nov 2015 Link to this post


    The floating images are not supported by the PdfFormatProvider, used to  export RadFlowDocument. We have already logged a request for this feature and you could vote and subscribe to the related feedback item in order to receive updates about status changes on it.

Back to Top