使用c#在浏览器中将可编辑的pdf显示为不可编辑的pdf

时间:2015-08-06 06:34:58

标签: c# pdf azure

我从azure blob获得了可编辑的pdf。当我在新标签中打开它时,它是可编辑的形式。但我想在浏览器中点击链接时将其显示为不可编辑的用户。这就是我到目前为止所做的事情:

public ActionResult OpenPdf(string fileName)
    {
        var storageAccount = CloudStorageAccount.Parse(
            ConfigurationManager.AppSettings["AzureWebJobsStorageConnection"]);
        var blobClient = storageAccount.CreateCloudBlobClient();
        CloudBlobContainer blobContainer =
            blobClient.GetContainerReference(ConfigurationManager.AppSettings["CertsBlobContainer"]);
        CloudBlockBlob blob = blobContainer.GetBlockBlobReference(fileName);
        var stream = new MemoryStream();
        if (blob.Exists())
            blob.DownloadToStream(stream);
        Response.AddHeader("Content-Disposition", "inline; filename=" + fileName);
        Response.BinaryWrite(stream.ToArray());
        return File(stream, "application/pdf");
    }

我该怎么做?

0 个答案:

没有答案