This project has moved. For the latest updates, please go here.

iTextSharePDF using ReportSource with large # of fields shows no content

Jan 15, 2012 at 8:21 PM

If you try to render a report using the DoddleReport.iTextSharp.PdfReportWriter using a ReportSource that has a large number of fields (for ex: a table with 50 columns) then the PDF does not show any content because the column sizes become too small to display any characters.

Is there are setting to get around this?

Setting the page size for the report might be an option.  Is there any way to the set the size of the pageSize of the PDF report to something other than Letter?   

This is a great tool, thanks!

Jan 18, 2012 at 3:15 PM

Setting the page size might be the only option with PDF. Right now the page size is harcoded, but I can make it an optional render hints so that you could specify your own Rectangle object to use as the page size when rendering the document.

I'll add this in the next release.

Jan 18, 2012 at 3:54 PM

There is also a RenderHint.Orientation which can be set to Landscape. This is good for wide reports. I know the AbcPdf report writer supports orientation and I believe this support is also in the iTextSharp one. That may help squeeze out some width as well. This should exist in the current release, so please give it a shot and let us know


Feb 8, 2012 at 2:19 PM
Edited Feb 8, 2012 at 3:30 PM

Hi Matt - first off, this project is brilliant and really easy to integrate into my reporting project.

I'm just starting to use DoddleReports and have just integrated it into my current project which is coded in VB.NET + MVC2; I will declare that I placed references to ABCpdf8 and compiled the binaries; I believe that the v8 & v7 WebSuperGoo component are backwardly compatible.

Anyhow my question> Does the Report Orientation currently work 100% with the ABCpdf interface? [report.RenderHints.Orientation = ReportOrientation.Landscape]

I gave it a poke but it seems to always put the PDF in Portrait.  I will note that when I was originally interfacing with ABCpdf8 directly, I ended up having to do this to generate a landscape report :

    'PROG_NOTE - Default DPI = 96 for this component assuming A4 is 8.27" x 11.69" for hardcopy on these reports or (800 x 1132 px).
        If Not portrait Then
            ' apply a rotation transform
            Dim w As Double = theDoc.MediaBox.Width
            Dim h As Double = theDoc.MediaBox.Height
            Dim l As Double = theDoc.MediaBox.Left
            Dim b As Double = theDoc.MediaBox.Bottom
            theDoc.Transform.Rotate(90, l, b)
            theDoc.Transform.Translate(w, 0)

            ' rotate our rectangle
            theDoc.Rect.Width = h
            theDoc.Rect.Height = w
        End If

        'Report must be a fully qualified URL and where the report has been generated
        theID = theDoc.AddImageUrl(url, True, CInt(IIf(portrait, width, height)), True)

        'Now do the Paging
        While True
            If Not theDoc.Chainable(theID) Then
                Exit While
            End If

            theDoc.Page = theDoc.AddPage()
            theID = theDoc.AddImageToChain(theID)
        End While


AD AMENDUM - Just found if I change ABCpdf/PdfReportWriter.cs :

        public PdfDocument BuildDocument(ReportTextFieldCollection textFields, RenderHintsCollection hints, ReportRowCollection rows)
            Document = hints.Orientation == ReportOrientation.Landscape ? new PdfDocument(ReportOrientation.Landscape) : new PdfDocument();


This assumes Portrait unless specified and works well.