# DPL Processing

You can configure the PDFViewer to use the [Telerik Document Processing library](https://docs.telerik.com/devtools/document-processing/introduction) for PDF processing.

## Requirements

* DPL Processing depends on the `Telerik.Pdf.Web` assembly.
* To use DPL Processing, the application must target <a href="https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0#select-net-standard-version" target="_blank">.NET Standard 2.0</a>.
* The `Read()` option is mandatory.

## Basic Configuration

The following example demonstrates how to configure the PDFViewer to use DPL Processing.

```Razor HtmlHelper
@(Html.Kendo().PDFViewer()
    .Name("pdfviewer")
    .DplProcessing(dpl => {
        dpl.Read(r => r.Url(Url.Action("GetInitialPdf", "PDFViewer")));
        dpl.Upload(upload => upload.Url(Url.Action("GetPdf", "PDFViewer")).SaveField("file"));
        dpl.LoadOnDemand(true);
    })
    .Toolbar(toolbar =>
        toolbar.Items(items =>
        {
            items.Add().Command("PageChangeCommand").Type("pager").Name("pager");
            items.Add().Name("spacer").Type("spacer");
            items.Add().Command("OpenCommand").Type("button").Name("open").Icon("folder-open");
        })
    )
    .Height(1200)
)
```

```C# Controller
using Newtonsoft.Json;
using System;
using System.IO;
using System.Web;
using System.Web.Mvc;
using Telerik.Pdf.Web;

namespace ProjectName.Controllers
{
    public class PDFViewerController : Controller
    {
        public ActionResult GetInitialPdf(int? pageNumber)
        {
            JsonResult jsonResult;
            byte[] file = System.IO.File.ReadAllBytes(Server.MapPath("~/Content/web/pdfViewer/DPLsample.pdf"));
            FixedDocument doc = FixedDocument.Load(file, true);

            if (pageNumber == null)
            {
                jsonResult = Json(doc.ToJson(), JsonRequestBehavior.AllowGet);
            }
            else
            {
                jsonResult = Json(doc.GetPage((int)pageNumber), JsonRequestBehavior.AllowGet);
            }

            jsonResult.MaxJsonLength = int.MaxValue;
            return jsonResult;
        }

        [HttpPost]
        public ActionResult GetPdf(HttpPostedFileBase file)
        {
            byte[] data;
            using (Stream inputStream = file.InputStream)
            {
                MemoryStream memoryStream = inputStream as MemoryStream;
                if (memoryStream == null)
                {
                    memoryStream = new MemoryStream();
                    inputStream.CopyTo(memoryStream);
                }
                data = memoryStream.ToArray();
            }
            FixedDocument dox = FixedDocument.Load(data);

            var resultData = dox.ToJson();

            var result = new ContentResult
            {
                Content = JsonConvert.SerializeObject(resultData),
                ContentType = "application/json"
            };

            return result;
        }
    }
}
```

> Starting with version 2024 Q4, the `FixedDocument.Load` and `FixedDocument.Download` methods and their overloads accept an additional, optional parameter—`TimeSpan timeOut`. The parameter indicates the timeout for the operation and defaults to 1 minute.

## Known Limitations

When using DPL Processing in the PdfViewer, the following limitations may be observed:

* Element clipping and gradient clipping are not supported.
* SVG images or images encoded in certain formats may not render correctly.

## See Also

* [DPL Processing by the PDFViewer HtmlHelper for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/pdfviewer/dpl-processing)
* [Server-Side API](https://www.telerik.com/aspnet-mvc/documentation/api/pdfviewer)
