Generate PDF From Flex

Hi All,
I am doing a Reporting/Chart application in FLEX. we need to
generate PDF from FLEX. Report data will be 5-10 pages, How we can
do this? Please advise.

thanks for your reply. I tried with alive pdf, but source
code only AIR files. can we use this in web based flex?. How we can
format the report like html code? I just see in alivepdf, its only
linebyline display, not multiple columns? pls advise.
thanks alot

Similar Messages

  • Generating PDF from Flex BarChart

    I am new to Flex. Have been playing with creating Advanced
    Data Grid and Bar Charts for our application prototype and would
    like to explore how to create a PDF file of the BarChart or other
    charting components.
    The requirement is simple. We show the BarChart and a button
    to view it as a PDF. When the user presses the button, the PDF
    viewing dialog should come up and the user can opt to save the PDF
    or view it (the standard way a browser deals with the PDF).
    Have read blogs, this forum and LiveCycle docs but don't
    understand clearly how Flex communicates with
    LiveCycle ES (or PDF Generator) to display the PDF. Any ideas
    or tutorials that does this would be appreciated.

    In order to generate a PDF document, you have to call a
    method on a Java remote object that uses the XFAHelper and pass it
    some arguments.
    I modified the PDFService example in the documentation so I
    1- specify any document as opposed to hardcoding the PDF
    template name
    2- write the PDF to a file as opposed to writing it in the
    user's session
    Here is the source:
    package com.mycompany.flex.remoteObjects;
    import org.w3c.dom.Document;
    import flex.acrobat.pdf.XFAHelper;
    import flex.messaging.FlexContext;
    import flex.messaging.util.UUIDUtils;
    public class PDFService
    public PDFService()
    public Object generatePDF(Document dataset, String
    PDFdocument) throws IOException
    // Open shell PDF
    String source =
    FlexContext.getServletContext().getRealPath("/pdfgen/" +
    int index = source.indexOf("./");
    if(index != -1 )
    // Remove the ./ added by UNIX
    source = source.substring(0, index) + source.substring(index
    + 2, source.length());
    XFAHelper helper = new XFAHelper();;
    // Import XFA dataset
    // Create a unique ID
    String uuid = UUIDUtils.createUUID(false);
    source =
    FlexContext.getServletContext().getRealPath("/dynamic-pdf/" + uuid
    + "_" + PDFdocument);
    index = source.indexOf("./");
    if(index != -1 )
    // Remove the ./ added by UNIX
    source = source.substring(0, index) + source.substring(index
    + 2, source.length());
    // Create the file object
    File file = new File(source);
    // Save the file;
    // Close any resources
    return (uuid + "_" + PDFdocument);
    pdfgen is the folder where my PDF template resides.
    dynamic-pdf is the folder where the generated PDF are saved.
    These two folders are located under flex.war at the first
    In Flex, I wrote a Cairngorm command that calls this remote
    object and displays the generated PDF:
    package com.mycompany.core.commands
    import com.adobe.cairngorm.commands.ICommand;
    import com.adobe.cairngorm.control.CairngormEvent;
    import com.mycompany.core.model.ModelLocator;
    import mx.collections.*;
    import mx.core.Application;
    import mx.controls.Alert;
    public class GenerateAndOpenPDFCommand implements ICommand,
    private var model:ModelLocator = ModelLocator.getInstance();
    public function GenerateAndOpenPDFCommand():void
    public function execute(event:CairngormEvent):void
    trace("Executing GenerateAndOpenPDFCommand...");
    var delegate : GenerateAndOpenPDFDelegate = new
    GenerateAndOpenPDFDelegate( this );
    var generateAndOpenPDFEvent : GenerateAndOpenPDFEvent =
    event as GenerateAndOpenPDFEvent;
    delegate.generateAndOpenPDF( generateAndOpenPDFEvent.pdfVO
    public function onResult( event : * = null ) : void
    var item:Object;
    var result:String = (event as ResultEvent).result as String;
    trace("GenerateAndOpenPDFCommand::onResult\n\n" + result);
    if (result)
    // Open the generated PDF in a new window
    navigateToURL(new URLRequest(ModelLocator.FLEX_URL +
    "dynamic-pdf/" + result), "_blank");
    // Hide the progress bar overlay
    Application.application.requestProgressBar.visible = false;
    Application.application.requestProgressBar.progressBar.source =
    = this.model.languageDictionary["000012"];
    public function onFault( event : * = null ) : void
    // Hide the progress bar overlay
    Application.application.requestProgressBar.visible = false;
    Application.application.requestProgressBar.progressBar.source =
    // Debug"GenerateAndOpenPDFCommand:\n\n" + (event as
    FLEX_URL is created in this way some place else in the
    // Get the server URL from the Application's
    var server:String = Application.application.url;
    var index:uint = server.indexOf("Shell"); // Shell is the
    name of my app folder
    server = server.substring(0, index);
    // This is the flex.war/ URL
    ModelLocator.FLEX_URL = server;
    Of course, it would be better to save the PDF in the user's
    session as Adobe suggests, but I couldn't figure out how they use
    the PDFResourceServlet. First of all, I had to get its code.
    I had to decompile the java class files in the samples to get
    the source of the PDFResourceServlet as it is not in the
    documentation. Here it is:
    package com.mycompany.flex.remoteObjects;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class PDFResourceServlet extends HttpServlet
    public PDFResourceServlet()
    protected void doGet(HttpServletRequest req,
    HttpServletResponse res)
    throws ServletException, IOException
    doPost(req, res);
    protected void doPost(HttpServletRequest req,
    HttpServletResponse res)
    throws ServletException, IOException
    String id = req.getParameter("id");
    if(id != null)
    HttpSession session = req.getSession(true);
    byte bytes[] = (byte[])(byte[])session.getAttribute(id);
    if(bytes != null)
    } else
    catch(Throwable t)
    private static final long serialVersionUID =

  • Generating pdfs from Flex

    I'd like to generate pdf files from Flex. How is this done? How much does it cost? How flexible is it? c-or-air-flex-or-flash/ checkout this link..can be done freely

  • Generate report from flex

    If its possible to generate report from flex.Please help me

    thanks for your reply. I tried with alive pdf, but source
    code only AIR files. can we use this in web based flex?. How we can
    format the report like html code? I just see in alivepdf, its only
    linebyline display, not multiple columns? pls advise.
    thanks alot

  • JNDI error while generating pdf from crystal reports in java

    Hi, i want to generate PDF from crystal reports in java. I have the .PDF file with database configured into the report. Following details are available in report.
    1. Server Name      = testdb
    2. Database Name  = testdb
    3. User
    4. Password
    I am using CR XI.
    In CRConfig.xml i had given following details.
    When i am calling from java as standalone, i am getting following error.
    JRCAgent1 detected an exception: Error finding JNDI name (testdb)
    at Source)      at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
    Can anyone let me know where is the problem?

    Actually, the question boils down to; does the framework support the fonts?
    I believe that my question re. this working in the designer was valid. The designer does not use the framework, so if it works there, it is either a framework issue or a runtime print engine issue.
    I believe if you use the code below, it will list fonts available to the framework:
    foreach(FontFamily ff in FontFamily.Families)
    For more information see kbase [1198306 - Crystal Report displaying incorrect font in Microsoft Visual Studio .NET|]

  • Generating PDF from Microsoft Word with C#

    We have created web-based system for a customer that stores/handles Microsoft word documents and provides these to users as PDF versions. Unfortunately some problems appear with our third-party component that generates PDF from Word. Our customer has previously used Adobe Acrobat X Pro to manually generate the PDF files and is confident that the output produced this way is valid. Despite searching and reading a lot I can't find any way to determine if (and how) it is possible to automate the process of generating a PDF file from a Microsoft word file using the Adobe engine. There is a lot of SDK documentation, how to control PDF rendering in winforms applications etc. etc. All I want to do is to load an Adobe Acrobat instance, feed it with a word document and save it as a PDF on disk. From a C# app (ASP.NET). Is that possible?
    Best regards
    Jan Hansen

    As mentioned, you can probably send the DOC file to the Adobe PDF printer to create the file. What I keep reading in your post is a legal issue. You keep mentioning being able to create the PDF on a server automatically. The server use of Acrobat is a violation of the EULA. If you are creting the files off-line for posting as has been done, there should not be a problem. However, having these created in an automated manner by the user may be an issue. Before you go much further, I would check with legal counsel about the use of Acrobat in the way you intend. If they indicate there is a problem, then your question is not needed.
    Back to the issue. Try just dropping a DOC file on the Adobe PDF printer icon (you may have to open the Start>Printers to do that. See if that creates the PDF. If so, you will just need to automate that process.

  • Gray box for logo generating pdf from fm book

    I have a large FrameMaker book that I've generated pdfs from a million times. We cleaned up our logo, so I dropped it in and tried to generate the usual pdf. a gray box resulted for the logo only. all other artwork displayed fine. i tried scaling down the logo, changing formats, changing import methods, etc. all failed. however, generating a pdf from the book if I remove a few chapters gives me my logo. Am I running out of resources? I'm using tech comm suite 1.3 on vista. There are no clues in the acrobat log. show large images is turned on in the adobe reader.
    I used the obvious workaround: generated two pdfs, one with just the logo page and one with the rest of the book, then combined them. But this process is not practical long term. Any clues?

    A couple questions:
    What format is the new logo file?
    Given that it works with some component files, but not in the book... I'd guess that it may be a resource issue. How much RAM and free space do you have?
    And when you "dropped it in," does that mean imported into one file by reference, or copied in, or imported into a template that you used to update all files in the book..... or something else? And if it did update multiple files, did you double-check them to make sure the path to the graphic is correct?

  • Generating PDF from MSWord--IsTable of Content Updated?

    In generating PDF from MSWord document does the Adobe process call a method on the MSWord object to update the TOC field in the Word document during the generation process. Or is it assumed that the table of content in the Word document is always updated. If the table of content field is not current, field error message can appear in the Word document and the page number for
    the link can contain inaccurate values.
    Thank you,

    It is assumed the TOC is up to date.

  • Generating pdf from scanner

    generating pdf from scanner hp G3010: old windows xp file weight 40-50 K. Macbook pro with new mac os 10.7.2 minimum file weight 1,9 Mbyte with terrible resolution!!!! and no way to reduce.
    Nice change?

    It is assumed the TOC is up to date.

  • I am able to generate PDF from Framemaker file but not able to generate pdf from book in robohelp

    Using robo help i am able to generate pdf  from a single framemaker file.
    but when i am importing whole book then i am not able to make it.
    And also it is not showing any error on console
    It goes to hang like situation and i have to close it from task maneger.

    Ok, silly question - why are you bothering to try and create PDFs from RH when you've got FM? FM to PDF produces great results; RH to PDF involves having to go through Word - i.e. RH - Word - PDF = too much work IMHO.

  • Conversion of PDF from flex

       I need to create pdf generation from flex.
       I tried with LCDS and there is no way to create XDP template.
       live cycle designer needs dotnet support.. but i need to do with j2ee..
       is any other approach to create pdf from flex with j2ee environment???
       thanks in advance...

    Hi there, there's a library called AlivePDF that allows you to create pdf files from Flex. Maybe that's what you're looking for.

  • How I Got WYSIWYG TLF Text To PDF from Flex

    Awesome results read more here:

    Adobe Reader currently doesn't support Text to Speech, but we have added this to our database for consideration in a future release.
    Thanks for your feedback!

  • How to generate PDF from template via REST query

    Hello. I'm newbie in Adobe LiveCycle, will appreciate any help.
    What we need: generate PDF from template, using different data.
    What we have: LiveCycle Designer and server with deployed Adobe LiveCycle ES 2.5 image.
    Looks like server works and listen 8080.
    In Livecycle Designer I can generate XML (XDP) from PDF, so I can change this XML in PHP/Python/Go script to fill template with data.
    I'm looking for some REST method, where I can give that XML (XDP) and recieve generated PDF in response.
    I've spent whole to for googling all these things, found a lot of docs, but all is very complicated there. Also, examples from just doesn't work - maybe I have to do something on server before calling REST API method.
    Please, push me into right direction

    Your best bet is to probably create an orchestration (or "process" in Adobe speak) that accepts two document parameters, calls LiveCycle Forms (or Output depending on whether you want to interactive or non-interactive PDF), and returns the resulting document variable.
    The orchestration will return a redirect that will point you to the document object.
    See Invoking LiveCycle using REST Requests, and Creating Your First LiveCycle ES4 Application.

  • Generate PDF From Database

    I have a table in database. Table has a column. There is data of pathes of images into column. I cretaed a illustrator template and I want to generate PDF from this template with using table data in database. so, is it possible? illustrator created pdf per each image with using illustrator template.

    AI cannot conent directly to databases. It can only parse CSV/ XML data. You either need to export the stuff or create extensive scripts to connect to the life database using sockets.

  • Can't generate PDF from xdp and XML

    I'm new to livecycle and flashbuilder.
    I assigned as a task to send to a  livecycle server a xdp template and a XML file with the data in order to create the pdf.
    So far, I created a class with two methods that returns as a BLOB the strings of a xdp template and the XML data to populate the template.
    On the main application I'm calling the generatePDFOutput method from the OutputService and as far as I know I'm supposed to get a Blob which I can manipulate to save it as a PDF.
    What could be my error? or how should I approach this problem? I came here since I can't find some document that shows how to create pdf from a flex app using livecycle...
    I appreaciate your help.
    I attach below the code of the main class
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx=""
                   xmlns:mx="library://" minWidth="955" minHeight="600" creationComplete="initializeChannelSet();">
                import flash.sampler.Sample;
                import mx.messaging.ChannelSet;
                import mx.messaging.channels.AMFChannel;
                import mx.rpc.CallResponder;
                import services.outputservice.OutputService;
                import valueObjects.BLOB;
                import valueObjects.OutputResult;
                import valueObjects.PDFOutputOptionsSpec;
                import valueObjects.RenderOptionsSpec;
                private var parentResourcePath:String="/";
                private var serverPort:String="";
                private function initializeChannelSet():void{
                    var cs:ChannelSet= new ChannelSet();
                    cs.addChannel(new AMFChannel("remoting-amf", "http://"+serverPort+"/remoting/messagebroker/amf"));
                protected function btn_clickHandler(event:MouseEvent):void
                var pdf:OutputService= new OutputService();
                var x:TestPDF= new TestPDF();
                var wsCall:CallResponder= new CallResponder();
                var out:PDFOutputOptionsSpec= new PDFOutputOptionsSpec();
                var render:RenderOptionsSpec= new RenderOptionsSpec();
                wsCall.token=pdf.generatePDFOutput("PDF","Form.xdp","D:\\PDF_Output",out,render,TestPDF.D ata());
                var res:BLOB= wsCall.lastResult as BLOB;
                var result:ByteArray= new ByteArray();
                    result=res as ByteArray;
                var a:Number=2;
                protected function outputService_resultHandler(event:ResultEvent):void
                    // TODO Auto-generated method stub
            <!-- Place non-visual elements (e.g., services, value objects) here -->
            <mx:RemoteObject id="outputService" destination="OutputService" result="outputService_resultHandler(event);"/>
        <s:Button id="btn" x="90" y="141" label="Button" click="btn_clickHandler(event)"/>

    build.xml file for Hibernate:
    <?xml version="1.0"?>
    <project name="Hibernate"
    default="schemaGenerator" basedir="C:\Hibernate">
    <property name="src.dir" value="src"/>
    <property name="classes.dir" value="classes"/>
    <property name="hibernate" value="hibernate-2.1"/>
    <property name="hibernate.mappings" value="mappings"/>
    <property name="jdbc" value="C:\oracle\product\10.1.0\Db_1\jdbc"/>
    <property name="hibernate.extensions" value="tools"/>
    <property name="" value="properties"/>
    <path id="project.class.path">
    <pathelement location="${classes.dir}" />
    <fileset dir="${hibernate}">
    <include name="hibernate2.jar"/>
    <fileset dir="${hibernate}/lib">
    <include name="*.jar"/>
    <fileset dir="${hibernate.extensions}/lib">
    <include name="*.jar"/>
    <fileset dir="${hibernate.extensions}">
    <include name="hibernate-tools.jar"/>
    <fileset dir="${jdbc}/lib">
    <include name="classes12.jar"/>
    <target name="init"> <mkdir dir="${src.dir}"/>
    <mkdir dir="${classes.dir}"/>
    <taskdef name="javaGen"
    <target name="javaGenerator" depends="init">
    <javaGen output="${src.dir}">
    <fileset dir="${hibernate.mappings}">
    <include name="Catalog.hbm.xml"/>
    <target name="compile" depends="javaGenerator">
    <javac srcdir="${src.dir}"
    <classpath refid="project.class.path"/></javac>
    <taskdef name="schemaGen"
    <target name="schemaGenerator" depends="compile">
    <schemaGen properties="${}/" quiet="no">
    <include name="Catalog.hbm.xml"/>

Maybe you are looking for

  • Planned Order Creation using MD_PLANNED_ORDER_CREATE

    Hi ,    I am using the FM MD_PLANNED_ORDER_CREATE , to create planned order . The start date of the planned order changes based on the factory calendar, is there some way to avoid this the FM has a parameter ECM61S used to pass the scheduling paramat

  • A simple problem

    HI, I am very new to jsp. I have been playing around with JSP include: <jsp:include page ... I am just wondering how I can include a html page that is outside of the server? E.g. <jsp:include page="" /> Could somebody p

  • TV Remote set-up

    I've an LG model 37 LH 2000. None of the codes in the book work. Anyone got the same problem or know a fix? Regards Tony

  • Web Service Security not configured on this component.

    Hi Experts,                        Before configuring the scenario, i went to RWB to check whether the comopnents are in active mode or not.                               Integration Engine XID                                Business Process Engine X

  • Transfer photos from my MacBook to my MacBook air

    Hi I am trying to transfer all photos from my old MacBook. The operating system is leopard 10.5.8 I believe! My new MacBook Air is mountain lion and is up to date. I am currently trying to transfer the files from the old mac to the new MacBook Air vi