yyn0210 / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

addimage -- adding a chart to PDF and the chart gets clipped #279

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

BACKGROUND
----------
I have pretty simple code.  I've added a chart to a Flex 4 project (Flash 
Builder) then add some data to the chart, then create a PDF and using addImage 
I add the chart (DisplayObject) to the PDF. 

PROBLEM
-------
When I open the PDF, the chart is clipped.  The entire chart is not shown.  I 
do not know how to resolve this.  I've tried various ways of trying to pass 
sizes to the addImage method ... but it does not show up.  Please help!

See all the code below.

MXML Declaration
----------------------
<components:FusionCharts includeIn="DetailsChart" x="289" y="143" id="pieChart" 
FCChartType="Doughnut3D" FCFolder="fusioncharts" FCUseDefaultData="false" 
height="279" width="551"/>

ActionScript to fill the chart
------------------------------
var pieData:ArrayCollection=new ArrayCollection([
{label:"T",value:calculationVariables.TotalAnnualTimeSavings,hoverText:"Time"},
{label:"O",value:calculationVariables.TotalAnnualOperationalGains,hoverText:"Ope
rations"}]);

var pieParams:ArrayCollection=new ArrayCollection([               
{ caption:'Year 1 Savings' },
{ bgColor:'FFFFFF' },
{ numberPrefix:'$' }                
]);

pieChart.FCData(pieData);
pieChart.FCParams(pieParams);
pieChart.FCRender();

Actionscript to add the chart to the PDF
----------------------------------------
var myPDF:PDF = new PDF( Orientation.LANDSCAPE, Unit.MM, Size.A4 );

myPDF.setDisplayMode ( Display.REAL ); 

myPDF.addPage();                    

myPDF.addImage(pieChart,0,0,myPDF.getMargins().width,myPDF.getMargins().height);

myPDF.save( Method.REMOTE, 
"http://alivepdf.bytearray.org/wp-content/demos/create.php", 
"AirClicSimulation.pdf" );

Original issue reported on code.google.com by priteshp...@gmail.com on 12 Sep 2010 at 3:11

GoogleCodeExporter commented 8 years ago
Hi Pritesh

I have this same problem, i'm adding charts to a pdf file, 6 on a page 2 on a 
line.
It works fine, but for certain charts it seems to clip them.

Have you found a solution to this problem?

If you have, please assist me.
faizal_ac@yahoo.com

Thanks

Original comment by m.faizal...@gmail.com on 6 Dec 2010 at 1:20

GoogleCodeExporter commented 8 years ago
Am also facing the similar issue. 
Anyone found some good solution ?

Original comment by walkwith...@gmail.com on 22 Jun 2011 at 11:54

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
myPDF.addImage(imageForm.getCmImage(),null,myPDF.getMargins().width/2-20,5,60,60
);

this worked for me..
Please ensure that your image is not bigger in width and height than the piece 
of the page of the pdf that you are trying to add it to...
 If it is bigger then it will simply chop off the portion that cannot fit in the specified space...

Original comment by m.faizal...@gmail.com on 22 Jun 2011 at 12:01