PdfFormatProvider // Exporting multiple HTML pages

3 posts, 0 answers
  1. Zen
    Zen avatar
    9 posts
    Member since:
    Jun 2012

    Posted 11 Sep 2015 Link to this post

    A web based application, I am working on, must provide users with the ability to export a collection of articles to one single PDF document. This articles contain HTML code for formatting the text as well as positioning of various parts of the article.

    Below is the code which I came up with for Exporting one single article:


    var html = File.OpenText(artPath).ReadToEnd();
    var buffer = new byte[0];

    var pdfProvider = new PdfFormatProvider();
    var htmlFormatProvider = new HtmlFormatProvider();

    HtmlImportSettings importSettings = new HtmlImportSettings();
    importSettings.UseHtmlHeadingStyles = true;

    htmlFormatProvider.ImportSettings = importSettings;

    var document = htmlFormatProvider.Import(html);
    document.LayoutMode = DocumentLayoutMode.Paged;

    buffer = pdfProvider.Export(document);

    using (var fs = new FileStream(pdfDocPath, FileMode.Create, FileAccess.Write, FileShare.Read))
    fs.Write(buffer, 0, buffer.Length);


    However, I am not being able to figure out how to export multiple articles into one single PDF document. Any help would be highly appreciated.




  2. Tanya
    Tanya avatar
    377 posts

    Posted 16 Sep 2015 Link to this post

    Hello Zen,

    The Merge functionality of RadPdfProcessing could help you achieve your goal. It allows to merge a source PDF document into a target document. More information about this feature is available in our documentation. In order to use the Merge() method in this library, you will need to create a RadFixedDocument. How you could achieve this is described in this article.

    Hope this is helpful.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Zen
    Zen avatar
    9 posts
    Member since:
    Jun 2012

    Posted 18 Nov 2015 in reply to Tanya Link to this post

    Thanks Tanya!


Back to Top