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.
Unfortunately, activation email could not send to your email. Please try again.

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

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

 

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.

Default.html

 

PdfViewerAPIController.cs

public class PdfViewerAPIController : ApiController

{

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

    {

        PdfViewerHelper helper = new PdfViewerHelper();

        helper.Load(Helper.GetFilePath("Barcode.pdf"));

 

        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;

    }

}

 

 

Sample:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewerASP1580520605

Article ID: Published Date: Last Revised Date: Platform: Control:
2626 11/12/2014 01/25/2016 Windows Forms PdfViewer
Did you find this information helpful?
Comments
ntn Jul 02, 2018

I want to know the format of this parametre

Load(Dictionary jsonResult)

Reply
Add Comment
You must log in to leave a comment

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.