Manoj Goyal
Manoj Goyal

Reputation: 11

SyncFusion PdfViewer library is not working

I am using the syncfusion pdf viewer library but showing only toolbar. It is not preview the pdf.

I am using syncfusion pdfviewer library to show pdf.

Steps follows by me

step1 : Added Js and css

<link href="https://cdn.syncfusion.com/16.1.0.24/js/web/flat-azure/ej.web.all.min.css" rel="stylesheet" />
<script src="https://cdn.syncfusion.com/16.1.0.24/js/web/ej.web.all.min.js"></script>

step2: Added javascript codefor intialize

$("#pdfContainerResume").ejPdfViewer({
            serviceUrl: "/Home/SyncfusionPdfViewer", 
            pdfService: ej.PdfViewer.PdfService.Local
        });

step3 : Create a Asp.net razor page to return the file.

savedFileName = "144eff20-122d-4f87-8a3b-d44300a252c4_Untitled document.pdf";

    byte[] FileData = null;
    FileOperationResult fileOperationResult = _fileService.Download(savedFileName, GreatDevelopers.FileStorage.Constant.DocumentType.Documents);
    if (fileOperationResult.Status == FileOperationStatus.Success)
    {
        FileData = (byte[])fileOperationResult.Data;
    }
    else
    {
        fileOperationResult = _fileService.Download(savedFileName, GreatDevelopers.FileStorage.Constant.DocumentType.Resumes);
        if (fileOperationResult.Status == FileOperationStatus.Success)
        {
            FileData = (byte[])fileOperationResult.Data;
        }
    }
    if (FileData != null)
    {
        string FileName = savedFileName;
        if (savedFileName.Contains('_'))
            FileName = savedFileName.Substring(savedFileName.Split('_')[0].Length + 1);

        return File(FileData, "application/msword", FileName);
    }

Upvotes: 1

Views: 118

Answers (0)

Related Questions