Expand my Community achievements bar.

Adding Charts as Images into PDF

Avatar

Level 4
Hi,

Is it possible to add charts(Coldfusion generated charts as images) into a PDF dynamically at runtime using Assembler service? If ıt is possible then can anybody provide a sample of DDX file to use?

And lastly in what other ways I can try to accomplish this task?

Thanks
1 Reply

Avatar

Former Community Member
1) Assembler can add the chart image file as a file attachment - either attached to the document as a whole, or to a specific page.



<?xml version="1.0" encoding="UTF-8"?>

<DDX xmlns="http://ns.adobe.com/DDX/1.0/">



  <PDF result="outDoc.pdf" >

    <PDF source="inDoc.pdf"/>

    <FileAttachments source="chart.jpg" nameKey="Chart">

      <File filename="chart.jpg" mimetype="image/jpeg"/>

      <FilenameEncoding encoding="UTF-8" />

      <Description>Chart from ColdFusion</Description>

    </FileAttachments>

  </PDF>



</DDX>



2) If PDF Generations service is available, then the image can be converted to a PDF and then any of the pagecontent elements can be used to place the image within the PDF:



<?xml version="1.0" encoding="UTF-8"?>

<DDX xmlns="http://ns.adobe.com/DDX/1.0/">



  <PDF result="outDoc.pdf" >

    <PDF source="inDoc.pdf"/>

    <BlankPage>

      <PageOverlay>

        <PDF source="chart.pdf"/>

      </PageOverlay>

    </BlankPage>

  </PDF>



</DDX>



Note: in the most recent release, LC ES Update 1, if the source idp.document mapped to chart.pdf for the <PDF> element is not a PDF document, Assembler will attempt to call the PDFG service to convert the document to a PDF before throwing an exception. Although, I would probably change the extension of the filename to be indicative of the type of incoming content, e.g. chart.jpg or chart.gif...