|
CONTENTS DELETED
The author has deleted this message.
|
|
@see iText in Action 2 - The reference for all itext stuff - chapter 16.3.3 integrating rich media ! On 3/08/2011 12:14, anishlodha04 wrote: > Hi, > I am new to itext and I am trying to embed fusion chart into a pdf as > RichMediaAnnotation but i am having some issues with that. > My swf file generates chart from an xml file. > i can't understand how to pass it as flashvars or by some other means so > that my embedded flash file can display charts. > > Here i am attaching my code. > > > ------------------------- > package com.embedflash; > > import java.io.FileNotFoundException; > import java.io.FileOutputStream; > > import com.itextpdf.text.Document; > import com.itextpdf.text.DocumentException; > import com.itextpdf.text.Rectangle; > import com.itextpdf.text.pdf.PdfAnnotation; > import com.itextpdf.text.pdf.PdfDeveloperExtension; > import com.itextpdf.text.pdf.PdfFileSpecification; > import com.itextpdf.text.pdf.PdfIndirectReference; > import com.itextpdf.text.pdf.PdfName; > import com.itextpdf.text.pdf.PdfWriter; > import com.itextpdf.text.pdf.richmedia.RichMediaActivation; > import com.itextpdf.text.pdf.richmedia.RichMediaAnnotation; > import com.itextpdf.text.pdf.richmedia.RichMediaConfiguration; > import com.itextpdf.text.pdf.richmedia.RichMediaInstance; > import com.itextpdf.text.pdf.richmedia.RichMediaParams; > > class TestEmbed > { > private static final String xmlString="<chart caption='Sales Summary' > subCaption='For the year 2010' numberPrefix='$' sformatNumberScale='1' > sNumberPrefix='$' syncAxisLimits='1' rotateValues='1' showSum='0'><set > label='Quarter 1' value='232400'/><set label='Quarter 2' > value='339800'/><set label='Quarter 3' value='411900'/><set label='Quarter > 4' value='398400'/> <categories><category label='Quarter 1'/><category > label='Quarter 2'/></categories> <dataset seriesName='Products'><set > value='232400'/><set value='232400'/> <dataset seriesName='Product A'><set > value='232400'/><set value='232400'/></dataset> <dataset > seriesName='Product B'><set value='232400'/><set > value='232400'/></dataset><dataset seriesName='All Services' renderAs='line' > parentYAxis='S'><set value='214400'/><set > value='214100'/></dataset></dataset><lineset seriesName='Target > Profitability' valuePosition='BELOW'><set value='104400'/><set > value='104100'/></lineset></chart>"; > > TestEmbed() > { > Document doc = new Document(); > try > { > FileOutputStream fos = new FileOutputStream("output.pdf"); > PdfWriter writer = PdfWriter.getInstance(doc, fos); > writer.setPdfVersion(PdfWriter.PDF_VERSION_1_7); > > writer.addDeveloperExtension(PdfDeveloperExtension.ADOBE_1_7_EXTENSIONLEVEL3); > doc.open(); > RichMediaAnnotation media = new RichMediaAnnotation(writer,new > Rectangle(50, 800, 800, 800)); > PdfFileSpecification fs = > PdfFileSpecification.fileEmbedded(writer,"Column3D.swf", "output.pdf", > null); > PdfIndirectReference asset = media.addAsset("Column3D.swf", fs); > media.addAsset("Column3D.swf", fs); > RichMediaConfiguration config = new > RichMediaConfiguration(PdfName.FLASH); > RichMediaInstance instance = new RichMediaInstance(PdfName.FLASH); > RichMediaParams flashVars = new RichMediaParams(); > > String vars = "&dataXML="+xmlString; > flashVars.setFlashVars(vars); > instance.setParams(flashVars); > > instance.setAsset(asset); > config.addInstance(instance); > > PdfIndirectReference configRef = media.addConfiguration(config); > RichMediaActivation activation = new RichMediaActivation(); > activation.setConfiguration(configRef); > media.setActivation(activation); > > PdfAnnotation mediaanote = PdfAnnotation.createScreen(writer, > new Rectangle(200f, 700f, 400f, 800f), "Column3D.swf", fs, > "application/x-shockwave-flash", true); > > mediaanote.setFlags(PdfAnnotation.FLAGS_PRINT); > writer.addAnnotation(mediaanote); > doc.close(); > } catch (FileNotFoundException e) { > e.printStackTrace(); > } catch (DocumentException e) { > e.printStackTrace(); > } catch (Exception e) { > e.printStackTrace(); > } finally { > doc.close(); > } > } > > public static void main(String[] args) > { > TestEmbed e = new TestEmbed(); > } > > } > > > -- > View this message in context: http://itext-general.2136553.n4.nabble.com/Embedding-Fusion-Charts-in-pdf-not-showing-any-chart-tp3714957p3714957.html > Sent from the iText - General mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos& much more. Register early& save! > http://p.sf.net/sfu/rim-blackberry-1 > _______________________________________________ > iText-questions mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > iText(R) is a registered trademark of 1T3XT BVBA. > Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ > Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
In reply to this post by anishlodha04
CONTENTS DELETED
The author has deleted this message.
|
|
In reply to this post by anishlodha04
Good you have the book ! :)
On 3/08/2011 12:14, anishlodha04 wrote: > Hi, > I am new to itext and I am trying to embed fusion chart into a pdf as > RichMediaAnnotation but i am having some issues with that. > My swf file generates chart from an xml file. > i can't understand how to pass it as flashvars or by some other means so > that my embedded flash file can display charts. > > Here i am attaching my code. > > > ------------------------- > package com.embedflash; > > import java.io.FileNotFoundException; > import java.io.FileOutputStream; > > import com.itextpdf.text.Document; > import com.itextpdf.text.DocumentException; > import com.itextpdf.text.Rectangle; > import com.itextpdf.text.pdf.PdfAnnotation; > import com.itextpdf.text.pdf.PdfDeveloperExtension; > import com.itextpdf.text.pdf.PdfFileSpecification; > import com.itextpdf.text.pdf.PdfIndirectReference; > import com.itextpdf.text.pdf.PdfName; > import com.itextpdf.text.pdf.PdfWriter; > import com.itextpdf.text.pdf.richmedia.RichMediaActivation; > import com.itextpdf.text.pdf.richmedia.RichMediaAnnotation; > import com.itextpdf.text.pdf.richmedia.RichMediaConfiguration; > import com.itextpdf.text.pdf.richmedia.RichMediaInstance; > import com.itextpdf.text.pdf.richmedia.RichMediaParams; > > class TestEmbed > { > private static final String xmlString="<chart caption='Sales Summary' > subCaption='For the year 2010' numberPrefix='$' sformatNumberScale='1' > sNumberPrefix='$' syncAxisLimits='1' rotateValues='1' showSum='0'><set > label='Quarter 1' value='232400'/><set label='Quarter 2' > value='339800'/><set label='Quarter 3' value='411900'/><set label='Quarter > 4' value='398400'/> <categories><category label='Quarter 1'/><category > label='Quarter 2'/></categories> <dataset seriesName='Products'><set > value='232400'/><set value='232400'/> <dataset seriesName='Product A'><set > value='232400'/><set value='232400'/></dataset> <dataset > seriesName='Product B'><set value='232400'/><set > value='232400'/></dataset><dataset seriesName='All Services' renderAs='line' > parentYAxis='S'><set value='214400'/><set > value='214100'/></dataset></dataset><lineset seriesName='Target > Profitability' valuePosition='BELOW'><set value='104400'/><set > value='104100'/></lineset></chart>"; > > TestEmbed() > { > Document doc = new Document(); > try > { > FileOutputStream fos = new FileOutputStream("output.pdf"); > PdfWriter writer = PdfWriter.getInstance(doc, fos); > writer.setPdfVersion(PdfWriter.PDF_VERSION_1_7); > > writer.addDeveloperExtension(PdfDeveloperExtension.ADOBE_1_7_EXTENSIONLEVEL3); > doc.open(); > RichMediaAnnotation media = new RichMediaAnnotation(writer,new > Rectangle(50, 800, 800, 800)); > PdfFileSpecification fs = > PdfFileSpecification.fileEmbedded(writer,"Column3D.swf", "output.pdf", > null); > PdfIndirectReference asset = media.addAsset("Column3D.swf", fs); > media.addAsset("Column3D.swf", fs); > RichMediaConfiguration config = new > RichMediaConfiguration(PdfName.FLASH); > RichMediaInstance instance = new RichMediaInstance(PdfName.FLASH); > RichMediaParams flashVars = new RichMediaParams(); > > String vars = "&dataXML="+xmlString; > flashVars.setFlashVars(vars); > instance.setParams(flashVars); > > instance.setAsset(asset); > config.addInstance(instance); > > PdfIndirectReference configRef = media.addConfiguration(config); > RichMediaActivation activation = new RichMediaActivation(); > activation.setConfiguration(configRef); > media.setActivation(activation); > Instead of PdfAnnotation.createScreen, try to create the annotation from the RichMediaAnnotation media.createAnnotation(); media.setF ..... > PdfAnnotation mediaanote = PdfAnnotation.createScreen(writer, > new Rectangle(200f, 700f, 400f, 800f), "Column3D.swf", fs, > "application/x-shockwave-flash", true); > > mediaanote.setFlags(PdfAnnotation.FLAGS_PRINT); > writer.addAnnotation(mediaanote); > doc.close(); > } catch (FileNotFoundException e) { > e.printStackTrace(); > } catch (DocumentException e) { > e.printStackTrace(); > } catch (Exception e) { > e.printStackTrace(); > } finally { > doc.close(); > } > } > > public static void main(String[] args) > { > TestEmbed e = new TestEmbed(); > } > > } > > > -- > View this message in context: http://itext-general.2136553.n4.nabble.com/Embedding-Fusion-Charts-in-pdf-not-showing-any-chart-tp3714957p3714957.html > Sent from the iText - General mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos& much more. Register early& save! > http://p.sf.net/sfu/rim-blackberry-1 > _______________________________________________ > iText-questions mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > iText(R) is a registered trademark of 1T3XT BVBA. > Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ > Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php Balder ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
CONTENTS DELETED
The author has deleted this message.
|
|
My answer was inline of your codesnippet :)
Instead of PdfAnnotation.createScreen, try to create the annotation from the RichMediaAnnotation media.createAnnotation(); media.setF ..... - if it's not this, I can't give a quick solution without the flash, the data, and the time (which I don't have atm) to check it. On 3/08/2011 13:25, anishlodha04 wrote: > I have the ebook but i am not able to do any good with it.... > > > Can u post me the snippet to pass xml as flashvars to swf embedded... > > -- > View this message in context: http://itext-general.2136553.n4.nabble.com/Embedding-Fusion-Charts-in-pdf-not-showing-any-chart-tp3714957p3715117.html > Sent from the iText - General mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos& much more. Register early& save! > http://p.sf.net/sfu/rim-blackberry-1 > _______________________________________________ > iText-questions mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > iText(R) is a registered trademark of 1T3XT BVBA. > Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ > Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
CONTENTS DELETED
The author has deleted this message.
|
|
Before anyone else grabs you warmly by the throat.. As a statement that helps no-one. Specifics might help. Otherwise who can possibly answer your question? Sent while on the move Begin forwarded message:
------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
In reply to this post by anishlodha04
On 3/08/2011 15:13, anishlodha04 wrote:
> But it isn't working... It works for us in the sense that we can embed FusionCharts SWFs into a PDF defining FlashVars. However: most FusionCharts SWFs aren't optimal for use in PDF. They have a scaleMode different from StageScaleMode.EXACT_FIT. As a result, the layout of the component gets all screwed up as soon as you print and/or zoom in/out. In order to fix this, you need to change the source code of the FusionCharts SWFs. That is problem 1: FusionCharts isn't open source in the sense that you only get the source if you have an enterprise license of FusionCharts. Problem 2 we've experienced with FustionCharts: if you succeed in setting the scaleMode correctly, the output is still bad for some components. To solve problem 2, you should rewrite the component to get an optimal visualization. This isn't really an iText problem. We've integrated FusionCharts SWFs into PDFs using the code from the book without any problem. However: we decided not to use FusionCharts because of Problem 1 and Problem 2 described above. We decided to write our own SWFs. ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
CONTENTS DELETED
The author has deleted this message.
|
|
CONTENTS DELETED
The author has deleted this message.
|
|
On 4/08/2011 11:05, anishlodha04 wrote:
> I have embedded it in html file...So can i embed the html file in the > pdf...Will that be able to display charts in the pdf... Euh... No. I don't understand how that would work. ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
In reply to this post by anishlodha04
On 4/08/2011 11:03, anishlodha04 wrote:
> Hi, > > Am i doing it in a wrong way...Because i have also tried embedding the xml > file but still not getting anything. We don't know anything about Column3D.swf, so we can't comment on your question. ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
| Powered by Nabble | Edit this page |
