Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8948947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:07:24+00:00 2026-06-15T13:07:24+00:00

I have a View called ShowDocument.cshtml. I want to show the pdf document in

  • 0

I have a View called ShowDocument.cshtml.

I want to show the pdf document in a view.
First I am converting the html page to .pdf which contains the information as :

The code in the controller is:

Stream stream = HtmlToPdfBuilder.GetHtmlForm(model.Type, 16);

If I give return File(stream, "application/pdf", "Authorization.pdf"), I will be getting as save, save as dialog box.

I do not want this dialog box ,I want to show the pdf content inside the page only .

So Is there any pdf viewer in MVC so that I can show the content in a View only using some control

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:07:26+00:00Added an answer on June 15, 2026 at 1:07 pm

    This may not be exactly what you want but might meet your need. You can embed the PDF in a partial view then update the partial view via ajax with the PDF on the form submit button.

    Example code:
    Partial view

        @model Test.Models.ViewModel
    
    <style type="text/css">
    
    #pdfbox
    {
        width:600px;
        height:400px;
        border: 5px solid #ccc;
    }
    
    </style>
    
    <object id='pdfbox' type="application/pdf" data="@Url.Action("GeneratePDF", "Home", Model)">
        Click @Html.ActionLink("here", "GeneratePDF", "Home") to view the file.
    </object>    
    

    Controller call:

        public ActionResult GeneratePDF(ViewModel model)
        {
    
            byte[] bytes = OpenPDFAndGetBytes("Thepdfname");
            return File(bytes, "application/pdf");
        }
    
        public ActionResult RenderPDF(LabelViewModel model)
        {
            return PartialView(model);
        }
    

    main view:

    @using (Ajax.BeginForm("RenderPDF", "Home", new AjaxOptions { UpdateTargetId = "pdf" }))
    {
        <table>
            <tr>
                <td>
                    <fieldset>
                        <legend>Fill the form:</legend>
                            Some form junk can go here
                        <br />
                        <input type="submit" value="Display PDF" />
                    </fieldset>
                </td>
                <td>
                    <div id='pdf'>
                        @{
                            Html.RenderPartial("RenderPDF", Model);
                        }
                    </div>
                </td>
            </tr>
        </table>
    }
    

    (Edit: Changed “main view” to a title ish)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view and template called index.html. I have a image which is
I have a view called send_confirmation email - which basically sends emails. I want
I have a view called, clients which shows a list of calls from the
Ok, so here's the situation. I currently have a view controller called MainViewController which
I am new to iPhone development. I have a view called barView which is
I have a shared view called NotAuthorised in the folder 'Views/Shared'. I want to
Let's say you have a view called View Story which is just a web
I have a view (page) called DataGrowth.aspx, how can I display it in the
I have a View called View_CrossReference in Sybase. I want to create Model for
I have a view (called outPutView) that contains graphics, like uIImageViews and labels. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.