title: Rotativa HTML to PDF on ASP.NET MVC?
body: <p>I'm using <a href="https://www.codeproject.com/Tips/818197/Generate-PDF-in-ASP-NET-MVC-Using-Rotativa" rel="nofollow noreferrer">Rotativa</a> resources to create PDF files from my HTML page on an MVC ASP.NET project. Here is my code
  ...........</p>
  
  <pre><code>[HttpGet]
  public ActionResult DownloadCertificate()
  {
      return View();
  }
  
  public ActionResult DownloadViewPDF()
  {
     return new Rotativa.ViewAsPdf("DownloadCertificate") { FileName = "TestViewAsPdf.pdf" };
  }
  </code></pre>
  
  <p>priblem is it not generating my desire view's pdf.instate of it its generating my home page pdf..</p>
  
  <p>my view for <code>ActionResult DownloadCertificate()</code> action  =></p>
  
  <pre><code>    @{
          ViewBag.Title = "DownloadCertificate";
          Layout = "";
      }
      &lt;html&gt;
      &lt;head id="Head1"&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /&gt;
          &lt;title&gt;
              Krogarna.se Certificate
          &lt;/title&gt;
          &lt;style type="text/css" media="print"&gt;
              {
                  left: 0px !important;
                  width: 11in !important;
                  height: 8.5in !important;
                  font-size: 107% !important;
              }
          &lt;/style&gt;
  
          &lt;style type="text/css" media="all"&gt;
              #top {
                  height: 100%;
              }
  
              #position_me {
                  left: 0;
              }
  
              .SlideBackGround {
                  height: 650px;
                  width: 880px;
                  position: fixed;
                  margin: 10px 10px 10px 10px;
                  background-color: white;
                  background-image: url(http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/frame.png);
                  background-size: 880px 650px;
                  background-repeat: no-repeat;
                  z-index: 2;
                  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/frame.png',sizingMethod='scale');
                  -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='frame.png',sizingMethod='scale')";
              }
  
              .MiddlePart {
                  height: 170px;
                  width: 670px;
                  position: fixed;
                  left: 125px;
                  top: 80px;
                  background-image: url(http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/middle_part.png);
                  background-size: 670px 170px;
                  background-repeat: no-repeat;
                  z-index: 5;
                  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/middle_part.png',sizingMethod='scale');
                  -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='middle_part.png',sizingMethod='scale')";
              }
  
              .Seal {
                  height: 90px;
                  width: 90px;
                  position: fixed;
                  left: 415px;
                  top: 420px;
                  background-image: url(http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/sigill.png);
                  background-size: 90px 90px;
                  background-repeat: no-repeat;
                  z-index: 5;
                  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/sigill.png',sizingMethod='scale');
                  -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='sigill.png',sizingMethod='scale')";
              }
  
              .Ribbon {
                  width: 60px;
                  height: 90px;
                  position: fixed;
                  left: 435px;
                  top: 520px;
                  background-image: url(http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/band.png);
                  background-size: 60px 90px;
                  background-repeat: no-repeat;
                  z-index: 5;
                  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/band.png',sizingMethod='scale');
                  -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='band.png',sizingMethod='scale')";
              }
  
              .Signature {
                  width: 180px;
                  height: 90px;
                  position: fixed;
                  left: 582px;
                  top: 517px;
                  background-image: url(http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/signature.png);
                  background-size: 180px 90px;
                  background-repeat: no-repeat;
                  z-index: 11;
                  filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://dotnet.ondev.com/ft63/content/sections/certificates/upload/krogarnase/signature.png',sizingMethod='scale');
                  -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='signature.png',sizingMethod='scale')";
              }
  
              .DateLine {
                  width: 300px;
                  position: fixed;
                  left: 112px;
                  top: 570px;
                  z-index: 11;
              }
  
              .ExaminerLine {
                  width: 300px;
                  position: fixed;
                  left: 500px;
                  top: 570px;
                  z-index: 11;
              }
  
              .ExaminerText {
                  width: 270px;
                  position: fixed;
                  left: 632px;
                  top: 585px;
                  color: #8B7B67;
                  z-index: 11;
              }
  
              .DateText {
                  width: 270px;
                  position: fixed;
                  left: 232px;
                  top: 585px;
                  z-index: 11;
                  color: #8B7B67;
              }
  
              .ParagraphSmall {
                  height: 200px;
                  width: 500px;
                  position: fixed;
                  left: 200px;
                  top: 350px;
                  font-size: 13px;
                  text-align: center;
                  z-index: 11;
                  color: #8B7B67;
              }
  
              .ParagraphMedium {
                  height: 200px;
                  width: 420px;
                  position: fixed;
                  left: 240px;
                  top: 260px;
                  font-size: 14px;
                  text-align: center;
                  z-index: 11;
                  color: #8B7B67;
              }
  
              .HeadingLarge {
                  height: 200px;
                  width: 600px;
                  position: fixed;
                  left: 330px;
                  top: 130px;
                  font-size: 66px;
                  z-index: 11;
                  color: #8B7B67;
              }
  
              .MiddleLine {
                  width: 720px;
                  position: fixed;
                  left: 100px;
                  top: 330px;
                  z-index: 11;
                  color: #8B7B67;
              }
  
              .StudentName {
                  font-weight: bold;
                  height: 200px;
                  width: 720px;
                  position: fixed;
                  left: 100px;
                  top: 310px;
                  font-size: 18px;
                  text-align: center;
                  z-index: 11;
                  color: #8B7B67;
              }
  
              .CompletionDate {
                  position: fixed;
                  left: 225px;
                  top: 555px;
                  z-index: 11;
                  color: #8B7B67;
                  text-align: center;
              }
          &lt;/style&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;div class="SlideBackGround"&gt;
          &lt;/div&gt;
  
          &lt;div class="MiddlePart"&gt;
          &lt;/div&gt;
  
          &lt;div class="HeadingLarge"&gt;Kursintyg&lt;/div&gt;
  
          &lt;div class="ParagraphMedium"&gt;
              HÄRMED INTYGAS
              ATT NEDANSTÅENDE PERSON KLARAT UTBILDNINGEN
              SERVERINGSTILLSTÅND
          &lt;/div&gt;
          &lt;div class="ParagraphSmall"&gt;
              Ni har visat prov på förståelse och kunnighet inom området alkoholservering. De 4 delar
              som avhandlats är: alkoholpolitik, tillsyn, servering samt mat, lokal och utrustning. Ni har
              efter denna utbildning de teoretiska kunskaper som krävs för att servera alkoholhaltiga
              drycker.
          &lt;/div&gt;
  
          &lt;div class="Seal"&gt;&lt;/div&gt;
  
          &lt;div class="Ribbon"&gt;&lt;/div&gt;
  
          &lt;hr class="DateLine" /&gt;
  
          &lt;hr class="ExaminerLine" /&gt;
  
          &lt;hr class="MiddleLine" /&gt;
  
          &lt;div class="DateText"&gt;Datum&lt;/div&gt;
  
          &lt;div class="ExaminerText"&gt;Examiner&lt;/div&gt;
  
          &lt;div class="Signature"&gt;&lt;/div&gt;
  
          &lt;div id="CompletionDatePanel" class="CompletionDate"&gt;
  
              &lt;span id="CompletionDateLabel"&gt;1/1/2014&lt;/span&gt;
  
          &lt;/div&gt;
  
          &lt;div id="StudentNamePanel" class="StudentName"&gt;
  
              &lt;span id="StudentNameLabel"&gt;John Doe&lt;/span&gt;
  
          &lt;/div&gt;
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>now instate of creating above views pdf it is generating my home(login) view ..cant make any sense why ... </p>
  
  <p><a href="https://i.stack.imgur.com/f3pwM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f3pwM.png" alt="enter image description here"></a>
  if there anyone who can help me about this.or can give me any tip how to get rid of this . or why i have done wrong. this will be greatfull.thanks in advance.....</p>