As I'm generating PDF in an ASP.NET-MVC project I'm using a method that renders the report and then makes it available for viewing in the browser.
public FileContentResult RenderReport(string reportName, List<dynamic> data, string format = "PDF", string deviceInfo = "")
{
LocalReport localReport = new LocalReport();
localReport.ReportPath = Server.MapPath("~/Reports/" + reportName + ".rdlc");
// Passa os dados para o arquivo .xsd
ReportDataSource reportDataSource = new ReportDataSource(reportName, data);
localReport.DataSources.Add(reportDataSource);
format = format.ToUpper();
string mimeType;
string encoding;
string fileNameExtension;
if (Common.Strings.IsEmpty(deviceInfo))
{
deviceInfo = "<DeviceInfo>" +
" <OutputFormat>" + format + "</OutputFormat>" +
" <PageWidth>21cm</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>2cm</MarginTop>" +
" <MarginLeft>2cm</MarginLeft>" +
" <MarginRight>2cm</MarginRight>" +
" <MarginBottom>2cm</MarginBottom>" +
"</DeviceInfo>";
}
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
renderedBytes = localReport.Render(
format,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
return File(renderedBytes, mimeType);
}
The last parameter of this method was added and then set the default values for the card. Ready. With this, the card / badge started to be generated with quality.