We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use the PDF viewer control in ASP.NET(Classic) platform?

Platform: ASP.NET Web Forms (Classic) |
Control: PDFViewer

We do not have support for the PDF viewer control in the ASP.NET(Classic). However, as a workaround we can use the ejPdfViewer control as in the below code snippet.


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js" type="text/javascript"></script>
    <link href="http://cdn.syncfusion.com/" rel="stylesheet" />
    <script type="text/javascript" src="http://cdn.syncfusion.com/ "></script>
    <!-- Creating a div tag which will act as a container for ejPdfViewer widget.-->
    <div id="viewer" style="height: 650px;width: 950px;min-height:404px;" ></div>
    <!-- initializing ejPdfViewer widget.-->
<script type="text/javascript">
    $(function () {
            serviceUrl: "/api/PdfViewerAPI"



public class PdfViewerAPIController : ApiController


    public object PostViewerAction(Dictionary<string, string> jsonResult)


        PdfViewerHelper helper = new PdfViewerHelper();



        object output = helper.ProcessPdf(jsonResult);

        string response = JsonConvert.SerializeObject(output);

        return response;




public class Helper


    public static string GetFilePath(string path)


        string _dataPath = GetCommonFolder(new DirectoryInfo(HttpContext.Current.Request.PhysicalApplicationPath));

        _dataPath += @"\" + path;

        return _dataPath;



    static string GetCommonFolder(DirectoryInfo dtInfo)


        var _folderNames = dtInfo.GetDirectories("Data");

        if (_folderNames.Length > 0)


            return _folderNames[0].FullName;



        return dtInfo.Parent != null ? GetCommonFolder(dtInfo.Parent) : string.Empty;







You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile