This is a migrated thread and some comments may be shown as answers.

export to pdf

19 Answers 1310 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Zeeshan
Top achievements
Rank 1
Zeeshan asked on 16 Jul 2007, 05:06 PM
I am currently trying to use export to pdf. It takes forever. Can seem to comprehend why it takes longer. Any hints on what i can look at to identify bottle necks. Secondly i want to know a little bit more about how u are generating pdf files specially the large files which could 10 to 12 mb. In the past i was using aspose to convert to pdf and it brought our server down cuz of high memory usage. Please explain.
You guys have a nice suite of products. I am so glad i finally convinced my company to move from infragistics.(nightmare!)

19 Answers, 1 is accepted

Sort by
0
Svetoslav
Telerik team
answered on 17 Jul 2007, 05:15 PM
Hello Zeeshan,

Thank you for the kind words. It is pleasure for us to hear that you like our controls.

The most common reason that causes the report rendering to hang (and that we're aware of) is when you have a subreport and the data source of this report is empty - i.e., returns no rows. To work around this issue simply add an empty report header with zero height (ex. Unit.Inch(0)).

Please note that if you missed to attach a data source to the subreport you can experience similar problems too.

Currently we have no known issues with the generation of larger PDF documents. The size of the output files depends on many criteria, the most important being:
  • the fonts you're using (to ensure that the created pdf can be viewed on every PC we embed all fonts. However, some fonts that support many languages are too large);
  • images - if you are using larger images this will enlarge the output file;
  • the compression process of the PDF.
As you can see there are several directions to improve the PDF generation and we're working on them. If you experience any problems with this functionality don't hesitate to contact us.

 
Regards,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Zeeshan
Top achievements
Rank 1
answered on 23 Jul 2007, 09:59 PM
pls provide a different workaround. this work around does not work for me when the sub report data is empty. When i set the report header height in the designer 0, it get an exception like this.

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) +2429105
   Telerik.Reporting.HtmlRendering.MatrixRowCollection.get_Item(Int32 index) +6
   Telerik.Reporting.HtmlRendering.Matrix.Render(HtmlRenderingContext context) +335
   Telerik.Reporting.HtmlRendering.ReportSectionBaseRenderer.Render(ReportItemBase item, HtmlRenderingContext context) +75
   Telerik.Reporting.HtmlRendering.HtmlItemRender.Telerik.Reporting.HtmlRendering.IReportItemRender.Render(ReportItemBase item, RenderingContext context) +67
   Telerik.Reporting.HtmlRendering.RenderingContext.Render(ReportItemBase item) +47
   Telerik.Reporting.HtmlRendering.SubreportRenderer.Render(ReportItemBase item, HtmlRenderingContext context) +187
   Telerik.Reporting.HtmlRendering.HtmlItemRender.Telerik.Reporting.HtmlRendering.IReportItemRender.Render(ReportItemBase item, RenderingContext context) +67
   Telerik.Reporting.HtmlRendering.RenderingContext.Render(ReportItemBase item) +47
   Telerik.Reporting.HtmlRendering.Matrix.Render(HtmlRenderingContext context) +1064
   Telerik.Reporting.HtmlRendering.ReportSectionBaseRenderer.Render(ReportItemBase item, HtmlRenderingContext context) +75
   Telerik.Reporting.HtmlRendering.HtmlItemRender.Telerik.Reporting.HtmlRendering.IReportItemRender.Render(ReportItemBase item, RenderingContext context) +67
   Telerik.Reporting.HtmlRendering.RenderingContext.Render(ReportItemBase item) +47
   Telerik.Reporting.HtmlRendering.HtmlPage.RenderBodyInternal(HtmlWriter bodyWriter) +614
   Telerik.Reporting.HtmlRendering.HtmlPage.Render(HtmlTextWriter writer, HtmlRenderingContext renderingContext) +152
   Telerik.Reporting.HtmlRendering.HtmlReport.Render(HtmlTextWriter writer) +353
   Telerik.Reporting.HtmlRendering.HtmlRenderingExtension.Telerik.Reporting.Processing.IRenderingExtension.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +260
   Telerik.Reporting.Processing.ReportProcessor.Render(String format, Report reportDefinition, Hashtable deviceInfo, CreateStream createStramCallback) +136
   Telerik.ReportViewer.WebForms.ServerReport.Render(HttpResponse response, String format, Int32 pageNumber, Boolean refresh) +784
   Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +72
   Telerik.ReportViewer.WebForms.HttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +118
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
0
Chavdar
Telerik team
answered on 24 Jul 2007, 11:36 AM
Hi Zeeshan,

It seems that Html rendering does not allow zero height for the report sections. To workaround this issue try to set the height of the report header to a small value greater than 0, for example 1pt.

We are sorry for the inconvenience. The issue is logged and will be fixed for the next release. Your points have been updated for the report.
 

Kind regards,
Chavdar
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Raj
Top achievements
Rank 1
answered on 24 Jul 2007, 03:33 PM
thks for the quick reply that actually works for me now i have another problem and that is when it exports to pdf i get an extra padding in the middle. I am trying to figure out what property to turn off so i dont get an extra padding. it seems to appear fine when viewing in the browser. Pls tell me what properties i need to look into. i have a report and sub report.
You have been a great help so far.

Thanks
0
Chavdar
Telerik team
answered on 24 Jul 2007, 04:50 PM
Hello Raj,

There can be different reasons for the padding. In order to help you it will be best if you can send us the main and sub report definitions so that we can investigate the issue. A screenshot which points out where is the problem will also be helpful. You can send us the files through the support ticketing system.

Thanks in advance.

Regards,
Chavdar
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Raj
Top achievements
Rank 1
answered on 24 Jul 2007, 05:31 PM
I have already created a support ticket on that a little while ago pls have a look at it and let me know.
Thanks
Zeeshan Hirani
0
chandrapal
Top achievements
Rank 1
answered on 10 Feb 2010, 08:33 AM
Hi,
I created Report , and Exported it to PDF, my report size is too bi, one page of PDF report is of 15 MB,

I sent this problem to support , support told me to use this

<configSections>

<section name="Telerik.Reporting" type="Telerik.Reporting.Processing.Config.ReportingConfigurationSection, Telerik.Reporting.Processing, Version=3.2.9.1104, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" allowLocation="true" allowDefinition="Everywhere" />

</configSections>

<Telerik.Reporting>

    <Extensions>

      <Render>

        <Extension name="PDF">

          <Parameters>

            <Parameter name="FontEmbedding" value="None" />

          </Parameters>

        </Extension>

      </Render>

    </Extensions>

  </Telerik.Reporting>


If I use this in configuration file then I got again exception "Telerik.Reporting.Processing" can not found.

What to do with this.
with regards
Chandrapal Singh
0
Steve
Telerik team
answered on 10 Feb 2010, 10:17 AM
Hello chandrapal,

We've noticed that you're using Telerik Reporting Q3 2009 and in that version there is no longer a Telerik.Reporting.Processing.dll assembly - it is not part of the Telerik.Reporting.dll. So the Telerik Reporting config section should be changed to reflect that change accordingly:

<section name="Telerik.Reporting" type="Telerik.Reporting.Processing.Config.ReportingConfigurationSection, Telerik.Reporting, Version=3.2.9.1104, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" allowLocation="true" allowDefinition="Everywhere" />

That is the information I've pointed you to in the KB article: The size of the exported PDF file is big.

All the best,
Steve
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
PRABHU
Top achievements
Rank 1
answered on 13 Jul 2010, 07:39 AM
I AM TRYING TO EXPORT A REPORT TO PDF.

THIS IS MY REPORT.

 

public class PDF_Export:Report

 

{

 

public PDF_Export()

 

{

 

//DetailSection detail = new DetailSection();

 

 

//detail.Height = new Telerik.Reporting.Drawing.Unit(3.0, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

//detail.Name = "detail";

 

 

//detail.Items.Add(new ReportItemBase());

 

 

this.DocumentName = "Patient";

 

 

this.DataSource = GetTable();

 

 

this.DataMember = "Table";

 

 

 

//Telerik.Reporting.Report r = new Report();

 

 

// this.DataSource = GetTable();

 

 

}

 

 

private DataTable GetTable()

 

{

 

DataTable table = new DataTable();

 

table.Columns.Add(

"Dosage", typeof(int));

 

table.Columns.Add(

"Drug", typeof(string));

 

table.Columns.Add(

"Patient", typeof(string));

 

 

//table.Columns.Add("Date", typeof(DateTime));

 

 

//

 

 

// Here we add five DataRows.

 

 

//

 

table.Rows.Add(25,

"Indocin", "David");

 

table.Rows.Add(50,

"Enebrel", "Sam");//, DateTime.Now);

 

 

//table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now);

 

 

//table.Rows.Add(21, "Combivent", "Janet", DateTime.Now);

 

 

//table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now);

 

 

return table;

 

}



then in my asopx page,i ahve the followong code for my button click

 

protected void Button1_Click(object sender, EventArgs e)

 

{

 

try

 

{

 

PDF_Export myRep = new PDF_Export();

 

Telerik.Reporting.Processing.

ReportProcessor reportProcessor = new ReportProcessor();

 

 

// SaveReport(myRep, "C:\\test\\test.pdf");

 

 

 

RenderingResult result = reportProcessor.RenderReport("PDF", myRep, null);

 

 

string fileName = result.DocumentName + ".pdf";

 

 

Response.Clear();

Response.ContentType = result.MimeType;

 

// Response.Cache.SetCacheability(HttpCacheability.Private);

 

 

// Response.Expires = -1;

 

Response.Buffer =

true;

 

Response.AddHeader(

"Content-Disposition", string.Format("{0};FileName=\"{1}\"", "attachment", fileName));

 

Response.BinaryWrite(result.DocumentBytes);

Response.End();

Response.Close();

 

}

 

catch (Exception ex)

 

{

}

}

My Problem is It generates  pdf BUT WITH NO DATAIN THE PDF.

Ca you please help?

0
Ayush Verma
Top achievements
Rank 1
answered on 13 Jul 2010, 07:59 AM

// Create Instance of your Report for which you want to create PDF

MyTelerikReport objMyTelerikReport = new MyTelerikReport() ;

ReportProcessor reportProcessor = new ReportProcessor();

RenderingResult result = reportProcessor.RenderReport("PDF", objMyTelerikReport, null);

FileStream fs = null;

fs = new FileStream(@“C:\mypdf.pdf”, FileMode.Create);

fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);

fs.Flush();

// To Open generated PDF

Process.Start(@“C:\mypdf.pdf”);

0
PRABHU
Top achievements
Rank 1
answered on 13 Jul 2010, 09:07 AM

I ASSIGN A DATATABLE AS A DATASOURCE TO THE REPORT

is the way i assign the data to the Report Correct[SEE BELOW CODE]?

because still i am not able to see the data in PDF

public
PDF_Export()

 

{

 

 

//DetailSection detail = new DetailSection();

 

 

 

//detail.Height = new Telerik.Reporting.Drawing.Unit(3.0, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

 

//detail.Name = "detail";

 

 

 

//detail.Items.Add(new ReportItemBase());

 

 

 

this.DocumentName = "Patient";

 

 

 

this.DataSource = GetTable();

 

 

 

this.DataMember = "Table";

0
Vijetha
Top achievements
Rank 1
answered on 13 Dec 2011, 02:06 PM
Hi,

I want to export data to pdf,xls,rtf using ReportViewerModel programatically
Below is the sample code i tried but it does not work .Please suggest

ExportButton_click
{

 

var reportViewerModel = ReportViewer1.DataContext as ReportViewerModel;

 

 

reportViewerModel.SaveExportCommand.Execute(null);
}

Thanks,
Vijetha

0
Teddy
Top achievements
Rank 1
answered on 03 Jan 2012, 11:33 AM
HI,
 me too i would like to know how could i export in different format
(xsl, pdf etc ...) 
with " SaveExportCommand.Execute"

Thanks, 
Teddy
0
Prasad
Top achievements
Rank 1
answered on 17 Jan 2012, 03:59 PM
Hi,

I am also getting the sam error.
it's working fine with some search criterion but not with all. This report return a pdf which about 2mb in size.After getting the "I

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
" errror  when i export the report to pdf i am able to download the report.

 

But in the report viewer the specified error is being displayed.

Server Error in '/' Application.

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +67
   System.ThrowHelper.ThrowArgumentOutOfRangeException() +16
   System.Collections.Generic.List`1.get_Item(Int32 index) +19
   Telerik.Reporting.HtmlRendering.HtmlElementRenderer.GetEndElement(ProcessingElement startElement) +267
   Telerik.Reporting.HtmlRendering.HtmlElementRenderer.BeginRender(HtmlRenderingContext context) +382
   Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +17
   Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
   Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
   Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
   Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
   Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
   Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
   Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
   Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
   Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
   Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
   Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
   Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
   Telerik.Reporting.HtmlRendering.HtmlTextBoxRenderer.RenderInternal(ProcessingElement processingElement, HtmlRenderingContext context) +163
   Telerik.Reporting.HtmlRendering.HtmlItemRender.Telerik.Reporting.HtmlRendering.IReportItemRender.Render(ProcessingElement processingElement, RenderingContext context) +92
   Telerik.Reporting.HtmlRendering.RenderingContext.Render(ReportItemBase item) +50
   Telerik.Reporting.HtmlRendering.Matrix.RenderInternal(HtmlRenderingContext context) +3645
   Telerik.Reporting.HtmlRendering.Matrix.Render(HtmlRenderingContext context) +40
   Telerik.Reporting.HtmlRendering.ReportSectionBaseRenderer.RenderInternal(ProcessingElement processingElement, HtmlRenderingContext context) +69
   Telerik.Reporting.HtmlRendering.HtmlItemRender.Telerik.Reporting.HtmlRendering.IReportItemRender.Render(ProcessingElement processingElement, RenderingContext context) +92
   Telerik.Reporting.HtmlRendering.RenderingContext.Render(ReportItemBase item) +50
   Telerik.Reporting.HtmlRendering.HtmlPage.RenderReportSections(HtmlWriter bodyWriter) +557
   Telerik.Reporting.HtmlRendering.HtmlPage.RenderBody(HtmlWriter bodyWriter) +320
   Telerik.Reporting.HtmlRendering.HtmlPage.Render(HtmlTextWriter primaryWriter, HtmlRenderingContext renderingContext) +112
   Telerik.Reporting.HtmlRendering.HtmlReport.Render(HtmlTextWriter writer, Int32 startPage, Int32 endPage) +304
   Telerik.Reporting.HtmlRendering.HtmlReport.Render(HtmlTextWriter writer) +56
   Telerik.Reporting.HtmlRendering.HtmlRenderingExtension.Telerik.Reporting.Processing.IRenderingExtension.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +134
   Telerik.Reporting.Processing.ReportProcessor.Render(IList`1 reports, ExtensionInfo extensionInfo, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback) +352
   Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo, CreateStream createStreamCallback, String& documentName) +421
   Telerik.ReportViewer.WebForms.ServerReport.Render(HttpResponse response, String format, Int32 pageIndex) in c:\Projects\Reporting\FromSC_scrum\@ReportingBuild\Reporting_Build\Net20\Telerik.ReportViewer.WebForms\ServerReport.cs:90
   Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperation(NameValueCollection urlQuery, HttpContext context) in c:\Projects\Reporting\FromSC_scrum\@ReportingBuild\Reporting_Build\Net20\Telerik.ReportViewer.WebForms\ReportPageOperation.cs:25
   Telerik.ReportViewer.WebForms.HttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) in c:\Projects\Reporting\FromSC_scrum\@ReportingBuild\Reporting_Build\Net20\Telerik.ReportViewer.WebForms\HttpHandler.cs:59
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +705
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137


My doubt is why i am able to export to pdf even though i get the error?
what i am missing, help me please!



Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3618

0
Steve
Telerik team
answered on 19 Jan 2012, 04:03 PM
Hi Prasad,

Upgrade to the latest internal build available for download in your account and let us know if the issues persists.

All the best,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Prasad
Top achievements
Rank 1
answered on 20 Jan 2012, 12:34 PM
steve,

Is it the  problem with data, because report is generated for other search criterion. After getting the error when i export it to pdf i am able to download the file .

Is the problem in Telerik or Data?
0
Prasad
Top achievements
Rank 1
answered on 20 Jan 2012, 02:39 PM
Raj,
Please let me know how did you overcome this.
I am also getting the same error which is yet to fixed.
0
Steve
Telerik team
answered on 21 Jan 2012, 04:00 PM
Hello Prasad,

We see that you have downloaded the Q3 2011 SP1 version, can you confirm whether the problem still occurs or not? If the latter, please open a support ticket and attach a sample runnable project which we can look into.

All the best,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Prasad
Top achievements
Rank 1
answered on 25 Jan 2012, 08:45 AM
Steve,

My problem has been resolved.

I am using telerik reportin 3.1 version.  In that i have used a hmlTextbox, it has an expression "Zurich" this expression led to get the "Index out of range exception" in report viewer. Here the root cause is "Zurich" is a font name.However i converted this to Upper case "ZURICH"  so that i am not getting the exception.

I hope this was fixed in latter versions of telerik .


Long back we also get this exception for sign "&".




Thanks Telerik support Team for Quick response towards actual root cause.

Tags
General Discussions
Asked by
Zeeshan
Top achievements
Rank 1
Answers by
Svetoslav
Telerik team
Zeeshan
Top achievements
Rank 1
Chavdar
Telerik team
Raj
Top achievements
Rank 1
chandrapal
Top achievements
Rank 1
Steve
Telerik team
PRABHU
Top achievements
Rank 1
Ayush Verma
Top achievements
Rank 1
Vijetha
Top achievements
Rank 1
Teddy
Top achievements
Rank 1
Prasad
Top achievements
Rank 1
Share this question
or