Word document to PDF conversion Image issue using PdfFormatProvider

6 posts, 0 answers
  1. Anup Indurkar
    Anup Indurkar avatar
    1 posts
    Member since:
    Oct 2009

    Posted 23 Apr 2014 Link to this post

    Hi there, 

           I have a Byte [ ] of word document containing Text, Images and Tables.
           I want to generate and store PDF file into the database table.
           I am able to generate the PDF file using below code but Image is not exporting to PDF.
           Text and Tables exported successfully.

            public void ByteArrayToPdf()
                Byte[] Document = null;
                RadDocument document = new RadDocument();
                PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
                RtfFormatProvider providerRtf = new RtfFormatProvider();

                string path = Path.GetTempPath() + "\\TempFile.doc";
                Document = File.ReadAllBytes(path);

                using (FileStream stream = File.Open(path, FileMode.Open))
                    document = providerRtf.Import(stream);

                Document = pdfFormatProvider.Export(document);

                if (Document != null && Document.Length > 0)

    Please help.

    Anup Indurkar
  2. Daniel
    Daniel avatar
    4949 posts

    Posted 28 Apr 2014 Link to this post

    Hello Anup,

    This won't work for doc files, but will do for docx provided that you freeze the images after the import. Sample code is shown below:
    (FileStream stream = File.Open(path, FileMode.Open))
       document = providerRtf.Import(stream);
    foreach (var imageInline in document.EnumerateChildrenOfType<ImageInline>())


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Arron
    Arron avatar
    22 posts
    Member since:
    Apr 2013

    Posted 08 May 2014 in reply to Anup Indurkar Link to this post

    Hi, Anup.
    How about these code:
    Dim PDF As New YGPic()
    Public Sub WordToPDFConversion()
    WordImportFolder = ("C/:YGDemo.docx")
    PicExportFolder = PicFormat.pdf
    End Sub
    doc.Store(@"C:/YG.docx", 1, @"C:/YG.pdf")
    It will help you convert Word Doc to PDF file. I hope you success. Good luck.

    Best regards,
  4. Alice
    Alice avatar
    1 posts
    Member since:
    Mar 2015

    Posted 24 Mar 2015 in reply to Arron Link to this post

    if you want to convert your PDF file
    without any issue then you have to use a professional PDF
    . Using any other PDF converter may harm your data and its
    formatting after conversion. So it is recommended that use a perfect PDF

  5. compLex
    compLex avatar
    1 posts
    Member since:
    Nov 2016

    Posted 10 Nov 2016 in reply to Daniel Link to this post

    we are looking for a good solution to convert word DOC files into PDF.
    The DOCX To PDF conversation in Telerik works really good.
    Is there a possible solution to convert DOC files as well?

    Thank you


  6. Daniel
    Daniel avatar
    4949 posts

    Posted 10 Nov 2016 Link to this post


    DOC format is not supported at this point. You can vote for the following item within our feedback portal:
    WordsProcessing: Support for .doc files

    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Back to Top