Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1590
Issue in created PDF with chart in it
posted

Hi,

I have exported my ultraChart to PDF also have added some text section in it. Now the issue i am facing is, in my pdf, for each section, a new page is created. I have added two text sections and than the AddCanvas section. Created PDF cotains three pages with each containing one section. Below is my code and i have also attach the generated PDF with this post. 

Report report = new Report();

/// Adding First Text Section
///
ISection firstTextSection = report.AddSection();
IText firstTitleText = firstTextSection.AddText();

Infragistics.Documents.Reports.Graphics.Font titleFont =
new Infragistics.Documents.Reports.Graphics.Font("Tahoma", 15f, Infragistics.Documents.Reports.Graphics.FontStyle.Bold);

Style titleStyle = new Style(titleFont, Infragistics.Documents.Reports.Graphics.Brushes.SteelBlue);
TextAlignment titleAlignment = new TextAlignment(Alignment.Center, Alignment.Middle);

firstTitleText.Alignment = titleAlignment;
firstTitleText.Style = titleStyle;
firstTitleText.AddContent("First Title");

/// Adding First Text Section
///
ISection secondTextSection = report.AddSection();
IText secondTitleText = secondTextSection.AddText();

secondTitleText.Alignment = titleAlignment;
secondTitleText.Style = titleStyle;
secondTitleText.AddContent("Second Title");

/// Adding chart section
///
this.ultraChart1.RenderPdfFriendlyGraphics(report.AddSection().AddCanvas().CreateGraphics());

/// Publising Report
///
report.Publish("F:\\Test.pdf", FileFormat.PDF);

Thanks

Generated PDF.rar
  • 115
    Verified Answer
    posted

    This sounds like just what I did when I first started working with these controls.  :-)

    Creating a Section actually will always start up a new page.  What you really want to do is create one Section object on the report.  To create your 'groupings', I would recommend looking into the other available reporting objects.  A good place to start is the Band object.  It will look something like this:

            IBand newBand = mySection.AddBand();

    You should be able to add your content (text, image, Canvas, etc.) into the band object.  Any time you want to start a new 'grouping' of objects in the report but not necessarily start a new page, then you add a new Band object and add new content to that new Band object.

    Hope that helps!