Instructions

Rotativa.io brings generating PDF files with the ease and control of Rotativa to the Microsoft Azure cloud infrastructure. Let’s see how it works.

How to create PDF from Asp.net MVC with Rotativa.io

date Aug 22, 2018

Using Rotativa.io is extremely easy and it will come natural to those familiar with Asp.Net MVC.

First of all install the Nuget package:
PM> Install-Package Rotativa.io

Then add two entries in your web.config file, with data from your Rotativa.io account preferences:

// values can be A4, B0, Letter etc
$rhq->SetPageSize(...);

// set the page width
$rhq->SetPageWidth(...);

// set the page height
$rhq->SetPageHeight(...);

// set the margins
$rhq->SetPageMargins(....);

// set other wkhtmltopdf switches
$rhq->SetCustomSwithes(...); 

Now you can create PDF docs from a razor view in basically two ways:

  • Using the ViewAsPdf action result, or
  • Using the PdfHelper class.

The PDF helper method was explained in a previous post, Rotativa.io WebApi support. It enables to create a PDF or a link to a PDF stored in Azure cloud storage. It is useful in case you need to do something with the PDF or the URL, for example to store it on you server, or to return it in a JSON result.

If you need to just show the file to the user or make him download it, you’ll use the first method, ViewAsPdf. With it you simply return a new instance in your MVC action, instead of returning the built-in View

How to create PDF from Asp.net MVC with Rotativa.io

date Aug 22, 2018

Using Rotativa.io is extremely easy and it will come natural to those familiar with Asp.Net MVC.

First of all install the Nuget package:
PM> Install-Package Rotativa.io

Then add two entries in your web.config file, with data from your Rotativa.io account preferences:

// values can be A4, B0, Letter etc
$rhq->SetPageSize(...);

// set the page width
$rhq->SetPageWidth(...);

// set the page height
$rhq->SetPageHeight(...);

// set the margins
$rhq->SetPageMargins(....);

// set other wkhtmltopdf switches
$rhq->SetCustomSwithes(...); 

Now you can create PDF docs from a razor view in basically two ways:

  • Using the ViewAsPdf action result, or
  • Using the PdfHelper class.

The PDF helper method was explained in a previous post, Rotativa.io WebApi support. It enables to create a PDF or a link to a PDF stored in Azure cloud storage. It is useful in case you need to do something with the PDF or the URL, for example to store it on you server, or to return it in a JSON result.

If you need to just show the file to the user or make him download it, you’ll use the first method, ViewAsPdf. With it you simply return a new instance in your MVC action, instead of returning the built-in View

How to create PDF from Asp.net MVC with Rotativa.io

date Aug 22, 2018

Using Rotativa.io is extremely easy and it will come natural to those familiar with Asp.Net MVC.

First of all install the Nuget package:
PM> Install-Package Rotativa.io

Then add two entries in your web.config file, with data from your Rotativa.io account preferences:

// values can be A4, B0, Letter etc
$rhq->SetPageSize(...);

// set the page width
$rhq->SetPageWidth(...);

// set the page height
$rhq->SetPageHeight(...);

// set the margins
$rhq->SetPageMargins(....);

// set other wkhtmltopdf switches
$rhq->SetCustomSwithes(...); 

Now you can create PDF docs from a razor view in basically two ways:

  • Using the ViewAsPdf action result, or
  • Using the PdfHelper class.

The PDF helper method was explained in a previous post, Rotativa.io WebApi support. It enables to create a PDF or a link to a PDF stored in Azure cloud storage. It is useful in case you need to do something with the PDF or the URL, for example to store it on you server, or to return it in a JSON result.

If you need to just show the file to the user or make him download it, you’ll use the first method, ViewAsPdf. With it you simply return a new instance in your MVC action, instead of returning the built-in View

How to create PDF from Asp.net MVC with Rotativa.io

date Aug 22, 2018

Using Rotativa.io is extremely easy and it will come natural to those familiar with Asp.Net MVC.

First of all install the Nuget package:
PM> Install-Package Rotativa.io

Then add two entries in your web.config file, with data from your Rotativa.io account preferences:

// values can be A4, B0, Letter etc
$rhq->SetPageSize(...);

// set the page width
$rhq->SetPageWidth(...);

// set the page height
$rhq->SetPageHeight(...);

// set the margins
$rhq->SetPageMargins(....);

// set other wkhtmltopdf switches
$rhq->SetCustomSwithes(...); 

Now you can create PDF docs from a razor view in basically two ways:

  • Using the ViewAsPdf action result, or
  • Using the PdfHelper class.

The PDF helper method was explained in a previous post, Rotativa.io WebApi support. It enables to create a PDF or a link to a PDF stored in Azure cloud storage. It is useful in case you need to do something with the PDF or the URL, for example to store it on you server, or to return it in a JSON result.

If you need to just show the file to the user or make him download it, you’ll use the first method, ViewAsPdf. With it you simply return a new instance in your MVC action, instead of returning the built-in View