This is a migrated thread and some comments may be shown as answers.

Stitch Multiple Documents

3 Answers 10 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Veteran
Iron
Iron
Joel asked on 28 Apr 2020, 07:44 PM

This is likely a Word Processing library question as well as an Editor question.

I want to have a tree/view/list.  For each node in the tree, I want to create a separate Editor document for the user.  Then, depending on the node selection, I want to output the Editor document for the selected node and its child nodes out to one PDF document.  I will need to insert numbering, use styles and formatting in order to indicate the level of the Editor output   Do you have an example that would allow me to stitch together the Editor information from multiple nodes and output it this way?

Thanks, 

Joel

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 01 May 2020, 10:11 AM

Hi Joel,

There are two approaches for such a scenario.

The first approach will be client-side. It will require obtaining the values of all Editors via editor.value() method as shown on Editor API demo. Then inject the values into a container on the web page, add styles and numbering as needed, and export this container to PDF via the Kendo UI Drawing API - PDF Output. The Document Export demo shows how to export a container element to PDF. Also Customizing the Appearance article for PDF Output may be useful for this scenario.

The second approach will be server-side. It will require to force server-side PDF export for the Editor by adding .ForceProxy(true) in PDF setting, e.g. on the UI for ASP.NET Core Editor PDF export demo:

      .Pdf(pdf => pdf
          .Margin(20, 20, 20, 20)
          .PaperSize("A4")
          .ProxyURL(Url.Action("Pdf_Export_Save", "Editor"))
          .ForceProxy(true)
      )

Thus the Pdf_Export_Save method will be called each time the Editor is exported, no matter what browser is used. This is the default implementation of the method from the demos:

        [HttpPost]
        public IActionResult Pdf_Export_Save(string contentType, string base64, string fileName)
        {
            var fileContents = Convert.FromBase64String(base64);

            return File(fileContents, contentType, fileName);
        }

Combining the exported PDF files on the server would require using Telerik RadPdfProcessing, which is part of Telerik Document Processing Library. This library is included in UI for ASP.NET Core distribution. The Merge, Split and Add Content demo shows how to merge content from two PDF files server-side.

I hope the above will help you to achieve the desired behavior.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Accepted
Dimitar
Telerik team
answered on 01 May 2020, 11:17 AM

Hi Joel,

A third approach will be to use Editor's _drawPDF method and trigger another _drawPDF  method after the first one is ready and then concatenate it to the previous as for example it is done in this Dojo snippet.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Joel
Top achievements
Rank 1
Veteran
Iron
Iron
answered on 01 May 2020, 03:33 PM

Nice to have multiple options.  I prefer for this to be done inside a Rest service.  So, I'm going to do this on the Server side.  Obviously, this is a bit involved so I'm going to mark this answered before I try it but I like this approach.  I'm sure I'll have questions once I get into it.

Thanks for your help,

Joel

Tags
Editor
Asked by
Joel
Top achievements
Rank 1
Veteran
Iron
Iron
Answers by
Dimitar
Telerik team
Joel
Top achievements
Rank 1
Veteran
Iron
Iron
Share this question
or