Wednesday, March 28, 2012

Max Height problem!

I have written a VB .Net application over 33 webforms which act as a "Wizard" interface by collecting data from a user on each screen - I have one backend SQL server 2000 table for each form.

When the user reaches the last form they have a "Print button" which when clicked creates a localreport, creates a dataset of all data across all tables, creates a reportdatasource based on the dataset.

It then reads a local rdlc file and performs various formatting options by dynamically changing the XML.

I then call LoadReportDefinition to load the report.

I then render the report as a PDF to a byte array and write the array to the response object:-

'Populate(Dataset)

thisdataSet = SqlHelper.ExecuteDataset(sqlConn, "spReportData", FormID)

'Create ReportDataSource

datasource = New ReportDataSource("Accountform_spReportData", thisdataSet.Tables(0))

rpt.LoadReportDefinition(GetCustomizedReportDefinition(thisdataSet, "c:\accountform\Accountformdata.rdlc"))

rpt.DataSources.Clear()

rpt.DataSources.Add(datasource)

rpt.Refresh()

bytes = rpt.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)

' ''Sent byte array to client

Response.Clear()

Response.ContentType = mimeType

Response.AddHeader("content-disposition", "attachment; filename=New Account Form.pdf")

Response.BinaryWrite(bytes)

Response.End()

Everything has been working a treat until I realised that the the report body appears to be limited to 160 inches in height. My report only ever has 1 very wide record in it and is a series of rectangles containing textboxes each rectange is set to have a page break after it. Given that each rectange is 27cm in height it appears that the maximum number of pages I will be able to render is 15 - I need it to be able to go up to 33.

Is there any way of combining 2 reports in to one when you call the render method?

Any other suggestions will be greatly appreciated.

That's an odd limitation. You may want to look at exporting two PDF files and then using a tool like abcPDF to join them.

Here's another article using itextsharp.

http://geekswithblogs.net/bsherwin/archive/2007/06/29/113566.aspx

cheers,

Andrew

No comments:

Post a Comment