Create PDF from html - images not resized

2 posts, 0 answers
  1. ian
    ian avatar
    4 posts
    Member since:
    May 2011

    Posted 06 Jul 2016 Link to this post


    I am creating an pdf document from an html, which contains a number of images. I notice a difference between the pdf created and when viewing the html in a browser. For example the html contains css to resize the images, however it appears this does not happen during the pdf conversion process, so the images look too big.


    I use the code below to create the pdf

    try {     using (var inputHtml = new MemoryStream(htmlEncoding.GetBytes(sourceString)))     {         var htmlProvider = new HtmlFormatProvider();         var document = htmlProvider.Import(inputHtml);         var editor = new RadFlowDocumentEditor(document);         using (Stream output = new FileStream(targetFolder + targetFilename, FileMode.OpenOrCreate))         {             var pdfProvider = new PdfFormatProvider();             pdfProvider.Export(document, output);         }     } }

  2. Tanya
    Tanya avatar
    577 posts

    Posted 07 Jul 2016 Link to this post

    Hello Ian,

    We replied in the support thread and I will suggest you continue the conversation there as we will need some additional details on the scenario in order to check what may cause this behavior.

    Telerik by Progress

Back to Top