STEW_ERI

Printing Html Page As A4 Document With Charts

Recommended Posts

Hello FusionCharts!

 

I currently have a report, which uses several FusionCharts as part of the reports. These are generated by code and show on the client side, at the moment using a width of 100%. Although the problem I am having is when I print them as PDF (using CutePDF or nativley in Chrome) they come out on the PDF and look like they have been squeezed, width wise.

 

I cant post any pics due to the nature of the data, but hopefully you get what I mean.

 

Is there a best practice for handling this type of print out, where the users are just selecting File > Print to PDF. For example setting a certain width for the charts or something, they are currently in a classic asp page.

 

Thanks in advance for any help.

 

Stewart

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi Stewart,

 

A warm welcome to FusionCharts Forum! smile.gif

 

Could you please send us the sample code with dummy data? If possible send us the screen-shot your issue with dummy data.

 

It would be more helpful for us to look into it.

 

Also, what FusionCharts version are you using?

 

Awaiting your response.

Share this post


Link to post
Share on other sites

Hi,

 

I am using FusionCharts XT(v3.2.2) SR4 and here is the code snippet which generates one of the charts although to test you can just create a HTML page, which a text block at the top then a chart (width 100%) with some more text below it, then another chart (width 100%).

 

Code Behind Code

   Function RenderAppAwardValue() As String

       'Create Stringbuilder
       Dim xmlData As New StringBuilder()

       'Generate the chart element
       xmlData.Append("<chart caption='Values (YTD)' bgAlpha='0,0' canvasBgAlpha='0' NumberPrefix='£' showBorder='0' formatNumberScale='1' rotatelabels='0' showvalues='1' connectNullData='1' showExportDataMenuItem='1' xAxisName='Academic Year' yAxisName='Value (£)' >")

       'Set DataSet and Values
       Dim AppNumSeries As String = "SET DateFormat dmy ..."
       Dim RSAppN As New DbConn(AppNumSeries)

       While RSAppN.ReadData.Read()

           xmlData.Append(String.Format("<set label='Apps. 10/11' value='{0}' />", RSAppN.ReadData("OlderCount")))
           xmlData.Append(String.Format("<set label='Apps. 11/12' value='{0}' />", RSAppN.ReadData("OldCount")))
           xmlData.Append(String.Format("<set label='Apps. 12/13' value='{0}' />", RSAppN.ReadData("CurrentCount")))
       End While

       RSAppN.ReadData.Close()

       'Set DataSet and Values
       Dim AwardNumSeries As String = "SET DateFormat dmy ...."

       Dim RSAwardN As New DbConn(AwardNumSeries)
       While RSAwardN.ReadData.Read()
           xmlData.Append("<vLine color='FF5904' thickness='2' />")
           xmlData.Append(String.Format("<set label='Awards 10/11' value='{0}' />", RSAwardN.ReadData("YEARBEFORECOUNT")))
           xmlData.Append(String.Format("<set label='Awards 11/12' value='{0}' />", RSAwardN.ReadData("LASTYEARCOUNT")))
           xmlData.Append(String.Format("<set label='Awards 12/13' value='{0}' />", RSAwardN.ReadData("CURRENTYEARCOUNT")))
       End While

       RSAwardN.ReadData.Close()

       xmlData.Append("</chart>")

       'Create the chart - Multi-Series Line Chart with data from xmlData
       Return FusionCharts.RenderChart("Charts/Column2D.swf", "", xmlData.ToString(), "AppAwardValueChart", "100%", "200", False, True, True)

   End Function

 

On the client side, there is an asp literal which loads the data returned from the above function. Although this is on an asp.net page, the current charts on a classic asp page and the process is the same, although the function is called for each chart.

 

I have attached a PDF output from the pages to show you what I mean by the charts being squeezed.

 

Stewart

Example_PDF.pdf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now