Friday, March 9, 2012

Export To PDF

Hi,

I have a table and a chart in my report .When i export it to PDF format the title of the report overlaps with the table and the chart spans 2 pages.

Is there a remedy for this?

I'm not sure I understand what's going on. Can you be more descriptive about the layout of the report?

In order to keep your chart on a single page, you can increase the report page width/height (Menu -> Report -> Report Properties) to change your page dimensions to accomodate the whole chart.

Thanks, Donovan

|||

Hi,

ok..Its like this..

i am generating a month wise report based on parameters supplied by an aspx page.This is being done dynamically by building the requisite RDL.

In the RDL generated i have a table which displays month - wise stats as well as a Title for the table(for which i have put a textbox atop the table).

when i view it from the report server he layout of the report is fine.Bit if the same report is exported to PDF, the title textbox overlaps with the tabular display.This is one problem.

The other one is that in the same report i have a chart beneath the table.When i generate a report for a long time period (say 1 yr), i have set the chart width to expand correspondingly.

When the report is viewed in Acrobat reader the chart spans 2 pages...ie...data for some months are displayed on the 1st page and the rest in the second.

I suppose i' m clear now....

|||

If the report items themselves overlap, our HTML will "push" one of the items around on the page rather than displaying the items on top of one another. Our PDF will not. Would you verify that this is not the cause of the first issue?

For the second, you can dynamically (at creation time) change the <Width> tag of the <Report> element based upon how much data the user is requesting. This will allow you to keep the PDF page wide enough to fit the chart on one page rather than breaking it across pages.

Thanks, Donovan

|||

Hi,

Thanks 4 ur reply...

As 4 the first issue of overlapping i have solved it myself...had to do wit setting the Top width in the report..

As for the second issue,I am right now doing it the way u 've suggested above. But in doing so, it spans well on the Page whereas when viewed in PDF it breaks across to the second page.

One more thing....Is there a way to minimize the gap betwwen the Plotarea of the chart and the Border of the chart?

Thanks once again....

|||

Could it be you're not taking into account margins? If you have a report page width of 20" and a body width of 20" with 1" margins on the left and right, you will still get a second horizontal page.

|||What are the Top, Left, Width and Height values for the chart? Is (Chart.Left + Chart.Width) > Body.Width, which is Report.Width - Report.LeftMargin - Report.RightMargin?|||

Hi,

CHart Width is 9 in., chart top is 1.875in,I have not specified left and height for the chart

|||Are you using the default page width and margin width for the report, which is 8.5" x 11" and 1" for margins? If so, this is the reason the chart is spanning two pages. The chart width needs to be less than or equal to the page width - the margins. In this case, the chart's width should be 6.5".|||

Hi,

You can try to design your report as normal ASP.NET page and then convert that page to PDF using the he HTML to PDF library for .NET from http://www.dotnet-reporting.com or the PDF Reports Generator Library for .NET from http://www.winnovative-software.com is what you need. It's pure .NET library, it doesn't use a printer driver. There is also a free html to pdf converter application built on top of this library. The conversion can be done with only a few lines of code:

Code Snippet

PdfConverter pdfConverter = new PdfConverter();
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
pdfConverter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Portrait;
pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal;
pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = true;
pdfConverter.PdfDocumentOptions.ShowFooter = false;
pdfConverter.PdfDocumentOptions.ShowHeader = false;
pdfConverter.LicenseFilePath = Server.MapPath(@."~/Bin");
byte[] downloadBytes = pdfConverter.GetPdfFromUrlBytes(MyURL);

Regards,

Razva

No comments:

Post a Comment