Software company albania
Header

Flex Print Preview and PDF Generation as All-in-One Preview Window Tool

November 11th, 2011 | Posted by Avenir Ace Cokaj in Flex AS3 | RIA - RADE

Adobe Flex provides a great functionality to print date especially with the  DataGrid printing which enables you to print data in a grid view. You can even find many examples on how to use it. Most of the time is even simple to use for small projects.

The most requested functionality or even example was on how to preview the report before the user sent it to the printer.
I have searched for days hoping to find something suitable for previewing the data before print or PDF preview but I just found incomplete examples and pieces of code that led me nowhere.

Therefore I had to build my own print preview tool while I was working on our KreatX ExcellentGrid. This extended grid component has many functionalities and components that were design to be loosely coupled this was also the case of print preview tool which resulted to be a entirely reusable anywhere with any DataGrid or AdvancedDataGrid.

This example illustrates how the user can select a range of rows or the entire data set from the AdvancedDataGrid (or simple Flex DataGrid) and enables the user to hide or show the desired columns before print preview. The print preview window/tool reflects the changes instantly by calculating the dimensions and the number of pages and finally printing.

Flex doesn’t have the capability to communicate with installed printers there fore the user must select again the size and layout of the print, in other words the flex printing tool is just a preview of what it can print but not the end result if the user doesn’t select those options again.

This might be the only completed printing utility you can find for free online. Check it out by clicking on the image.

Besides printing, our application provides the possibility to generate PDF directly in the client side in the same preview window. In this example you can find useful code for an image screen capture of the preview to pdf generation.

 

Check out the example here

and the Print Preview  SOURCE code of the printing component here

FOR THE ENTIRE SOURCE CODE, FLEX PROJECT ZIP, request it through comments below.

Please NO  GMAIL accounts because I can’t attach zip files.

You may contact me any time if you need some extra help integrating the code or for that matter anything related to Flex and ActionScript 3.

Happy coding.

You can follow any responses to this entry through the RSS 2.0 You can skip to the end and leave a response. Pinging is currently not allowed.

182 comments on “Flex Print Preview and PDF Generation as All-in-One Preview Window Tool

  1. Good idea Kreatx:) good luck in your job as a good software company in Albania.

    • Great work, I will share this component in my team, and use this in my company’s project, thank you avenir !!! If I hava any problem I will ask you ,- – !

      • Avenir Ace Cokaj on said:

        I hope this Flex DataGrid Printing and PDF generation component will be useful for your work, let me know if you need anything related to source code or other stuff related to flex, we have a very experienced team at KreatX that would be happy to help out.

    • Jabbar on said:

      Can you please send the source code to seejaff@yahoo.co.in

  2. Avenir Ace Cokaj on said:

    I have already sent you the source of the project to the email address you specified, for any questions or comment feel free to ask. Even though the project is a full solution to datagrid printing and pdf generation.

  3. Sivagiri on said:

    HI i need to build my application sir ,,,,,,,,so i need u r source code ….

    email id ..srkvsivagiri@gmail.com

  4. Maklei on said:

    Hi, Great work! can you please send me the code source. thank you in advance for your help.

    • Avenir Ace Cokaj on said:

      please provide me with a different email address that is not a gmail account

      • Praveen on said:

        Hi its Great work ! i tried to implement in project , but am unable to find “print option” component in given source. can u please share source code to this mail id : “baltha.praveen@rediffmail.com”. it could be great help for me ,Thanks Advance.

        Praveen.B

  5. Stanislav on said:

    Please, send me Flex project in e-mail

  6. aretsu on said:

    please send me the flex project, thanks. @aretsusandori@rocketmail.com

  7. robert baluyot on said:

    Hi, Great work! can you please send me the code source. thanks and God Bless!

  8. haechul.shin on said:

    Please, send me the Flex project source. that is great work! thanks.
    onrelease@hanmail.net

  9. Avenir Ace Cokaj on said:

    Let me know if didn’t receive my email with the source, enjoy guys

  10. bitgothic on said:

    good work
    and i need the demos thanks

  11. Santhosh on said:

    Thank you for sharing.. I searched many for the same but this one is the best among ALL… nice work…
    Please provide me Flex project source.

  12. Avenir Ace Cokaj on said:

    Let me know if you didn’t receive an email from me with the source.

  13. Can you please send me the source!!! This is excellent katiyani_oz@yahoo.ca

  14. Juan Maisterra on said:

    Just what I was looking for…… Great job!!!!!!

    Please send me the code.

  15. Very nice !!! Thanks for sharing. Please provide me your source code. Thanks

  16. wmy on said:

    Thanks for sharing………please send me the flex project, thanks. mingyuzhanshen@163.com

  17. kashif farooqi on said:

    please send me complete code of this
    plzzzzzzz

  18. kashif farooqi on said:

    Thats very great idea can u send me thats code at kashaf_farooqi@yahoo.com

  19. Peter on said:

    Nice work! It provides several functions the same as Flexicious. Appreciate it is FREE.
    I need THE ENTIRE SOURCE CODE, FLEX PROJECT ZIP. Could you pls do me a favor to send it to my mailbox? pqsbbs@163.com

  20. wang on said:

    can you give me a samplecode ? to my Email 564940585@qq.com

  21. senthil on said:

    Hi,
    Please snd the flex project ( pdf and print ) in flex

  22. iris on said:

    Very nice !!! Thanks for sharing. Please provide me your source code. Thanks

  23. iris on said:

    Hi,
    Please snd the flex project ( pdf and print ) in flex

  24. Paul Coates on said:

    Looks really good, can you please send me the code source.
    Thanks

  25. son kim on said:

    It is great.
    May I have the chance to look up the project source ?

    Thank you.

  26. son kim on said:

    Great…
    May I have the source ?

    Thanks.

  27. Steven Vegor on said:

    Avenir, this is great!! I would absolutely love to see the source! vegor59@yahoo.com

    Thank you!

  28. chao on said:

    please send me the flex project, thanks
    xuhuanchao@163.com

  29. Rama on said:

    Please send me the project zip file. My email is rkodumagulla@gmail.com

  30. Can I see your code? please help me.. send me a sample code to ado@gramediapublishers.com

    Many Thanks for your Code

    Regards’
    Ado

  31. Mohamed Faisal on said:

    Hi please send your complete code (zip) to my mail id
    my mail id is : fair.faisal@rediffmail.com

  32. Ashik on said:

    Hi….nice work…please can send me your full code (zip) file to my mail id…: flexfaisal@yahoo.com

  33. Schyns on said:

    Please send me the full code on schyns2003@gmail.com
    thank in advance

  34. Anju on said:

    Hi,
    Can you please send the code for this sample. Thanks in advance…

    Regards,
    Anju

  35. Anju on said:

    sorry, my mail id is anju@esynctraining.com

  36. Vanessa on said:

    Good afternoon.

    Very good your post. I wonder if you could send me the full source.

    Grateful.

  37. Arthur on said:

    Congratulations, your print preview is fantastic!!

    can you, please, send me Flex project in e-mail?

    Thank’s

  38. jj.lee on said:

    Hi please send your complete code (zip) to my mail id
    my mail id is : ljj1010@nate.com

  39. William Hoover on said:

    I would greatly appreciate your source code. Thanks for you great work.

  40. heyuebin on said:

    Hi, Can you please send the code for this sample. Thanks in advance…
    h_1688@163.com

  41. Stanley Audrey on said:

    wow, really cool code, this is what I already search for long time. Can you supplied me with the entire code? Thank you very much

  42. roul on said:

    Hi, nice one.Please send me the zip in my email id roulcse@gmail.com

  43. satyasri on said:

    Please send me entire project file. thank in advance.

  44. satyasri on said:

    Hi,nice work,i have similar requirement in my project,please send me the code ,its very urgent
    my mail id is mail2satyasri85@yahoo.com .

  45. Jitendra Tiwary on said:

    Hi please send your complete code (zip) to my mail id
    my mail id is :jitender.tiwary@smartfincon.com

  46. Maria on said:

    Would you please send me the entire source code. Thank You!!

  47. Lauren on said:

    Please send the zip file of the entire code. Thank you!

  48. Neil Kenny on said:

    Very nice! I would like the code if possible. Thanks

  49. Purush on said:

    Can you please share the project source… psham81@gmail.com

  50. regupathi on said:

    COULD YOU PLEASE PROVIDE THE ENTIRE SOURCE CODE, FLEX PROJECT . THANK YOU!!!

  51. Arnaldo on said:

    Pls send the source code project to my email address amsuarez@gmail.com
    and an example how to use it…

  52. Anju on said:

    Hi,

    Could you please share the source code files?
    Thanks,
    Anju

  53. Prateek on said:

    Sir plz send me your Project as soon as Possible

    Thanks in Adv

  54. Pappu on said:

    Hello Sir
    You have done a very good programming on flex printing.Requesting you to please send me the
    ENTIRE SOURCE CODE, FLEX PROJECT ZIP.It would be a great help.

    Thank you so much.

  55. fonsie on said:

    Hi, would you be so kind and send me your Project . Thanks in advance…

  56. Thrutch on said:

    I would be grateful if you could send me THE ENTIRE SOURCE CODE, FLEX PROJECT ZIP. Thank you for sharing this code.

  57. Marcus on said:

    Hi, You print preview is wonderful,
    would you be so kind and send me your Project . Thanks in advance…

  58. It would be grate if you could send me source code of your entire project Thank you for sharing this code.
    onurbasal_tr@yahoo.com

  59. Iverson on said:

    Hi, great work man! Can you send me the entire source code? Thanks

  60. Can you please share the project source… n3609@nate.com

  61. Subrahmanyam on said:

    great work.
    can u send the exported zip to my email
    subrahmanyam.sakhamuri@gmail.com

  62. Subrahmanyam on said:

    great work.
    can u send the exported zip to my email
    sakhamuri_sss@yahoo.com

  63. Anish Kumar on said:

    Hi,

    I was searching for the way for export grid to pdf and I got your post.
    I am very pleased with your source code but need some help.
    Can u send me the zip file of this project?

    Thanks in advance

  64. Anish Kumar on said:

    send the code on anishkumar0708@gmail.com

  65. abhishek on said:

    nice work friend,
    can you mail me full course code and will it work on flex 4.6?
    abhishekchess1@gmail.com

  66. bharath on said:

    plz send me the project zip file…,thank you

  67. bharath on said:

    plz send me that on cn.bharath@yahoo.com ….,

  68. can u plz mail me the source code

  69. please send the zip(print preview) file to this email id
    b.vasi@yahoo.com

  70. gideon issac on said:

    sir, pls mail me the source code of this

  71. gideon issac on said:

    can u pls mail me this…

  72. gideon issac on said:

    pls mail the source code to
    gide_live@live.com

  73. Very nice !!! Thanks for sharing. Please send me thats code at onellrr@hotmail.com. I need THE ENTIRE SOURCE CODE Thanks.

  74. please mail the source code to
    nylee@kumhoht.co.kr

  75. Ram kumar on said:

    Excellent work.Ca you mail me the entire code in zip format to my mail id
    ramkumarnalluri@hotmail.com

    • Ram Kumar on said:

      Thank you sir,for the quick reply.
      The code is generating PDF for all pages well.But when it comes to printing , the code is printing current page only.
      it is not working for all pages & given page range.(both options are disabled)
      Could you please modify the code and resend the code again?

      mail id ramkumarnalluri@hotmail.com

  76. Balasubramaniam on said:

    Pls Mail The Source Code….

  77. Balasubramaniam on said:

    Pls Mail The Source Code….
    spk.kiran@yahoo.com

  78. norberto estrada on said:

    Hi

    Nice example!!, I appreciate if you could send me the code pe_ens@hotmail.com

    Thanks!!

  79. can u sent me the source code?? g_lanks_02@yahoo.co.id

    thanks b4

  80. Can u please send me the source to the following email id bibin.9.joseph@gmail.com

  81. its a good work its very helpful for the Flex developers, can u please send me the code in below mentioned email bibin.9.joseph@gmail.com

  82. Hello Avenir Ace Cokaj,

    Great Work!!!!!!!!!!!!!!!!!!
    please send me the Complete Source code at this mail id -> kiledar2006@rediffmail.com

  83. Hi , its a good work.. can you please send me the source code to the following email id bibin.9.joseph@gmail.com

  84. Please send me whole source code to dimplesi2705@yahoo.co.in

  85. Fabio Carvalho on said:

    Please send the code on fabiomusico92@hotmail.com

  86. lejeune on said:

    Can you please send the source code to oe.lejeune@free.fr

  87. joshua on said:

    wonderful!Could you send your sample code to lyh7609@msn.com?Thanks!!!!

  88. Matur thank you mister

  89. Nato-SCL on said:

    Hi! Greate Work! Can you please send the source code to rcanales10@hotmail.com

    Thanks!

  90. 999 roses for you. Thanks a lot! Please send me begnaburm@yahoo.com

  91. DaewoongKim on said:

    please send full project source .zip

    I wish to use this example T^T

    -> feelipak@naver.com

  92. DaewoongKim on said:

    please send to feelipak@naver.com full project source

    I really need to this project source T^T

  93. jayakrishnan on said:

    Great work, please share me the project to sjaikrishs@yahoo.com.

    Thank you

  94. Juliano on said:

    Hi please send your complete code (zip) to my mail id
    my mail id is : juliano@kjdesign.com.br or julianodesigner@gmail.com

  95. Antonio on said:

    Very good job… can ou send me the project please?
    almeidato@hotmail.com

    Thank you.

  96. awesome, would you please share the project to iwannahero@sina.com, so many thanks

  97. Jay Harris on said:

    Could I get a copy of the source?

  98. Sebastian Koch on said:

    Please send me the Code to info@bomk.de

    THX

  99. Hi. Great Tool. Please can you forward source to sugan @ dev-x .co .za
    Thanks! Rgs. Sugan

  100. swathi on said:

    Please Provide me code.

  101. swathi on said:

    Please send me source code thanks in advance.

  102. sandhya.kamath on said:

    Great Work. Please send me the code

  103. Divya Nair on said:

    Great work…. It is really helpful… Thank You…. :)

  104. BRUNO RUIZ on said:

    poderia por favor enviar o código para imprimir pdf. grato!

    bruno.borges.ruiz90@gmail.com

  105. Paulo Omai on said:

    Dear Avenir,
    Greetings from Brazil and Congratulations for your work!

    Could you please provide me the entire source code and Flex Project zip?.

    Thanks an advanced,

    Paulo Omai

  106. andre Teodoro on said:

    i want the full source code please, i think you are genious.

  107. It’s Awesome
    Can you please send me the Full source code dude!
    My email: shravansofts2011@gmail.com

  108. It’s Awesome
    Can you please send me the Full source code dude!
    My Email: shravansofts@yahoo.com

  109. Otacilio on said:

    Can you please send me the Full source code?
    My e-mail: otaciliolacerda@hotmail.com

  110. Dan Leclaire on said:

    Great job! I’m new to Flex and I find it quite difficult to implement a good printing module within Flex. What I find amazing from your solution is the speed it takes to generate the preview and the actual job print. From what I’ve learned in this area takes an eternity before I get something printed out.

    Could you please send me the Full source code? I would like experiment on the intricacies of implementing such a functionality within Flex.
    My e-mail is: d.lec@datamaxbr.com

    Kindest regards and thanks in advanced!

    Dan

  111. Adilson on said:

    Excellent work Avenir Ace Cokaj, could you send me the source code for email padu_monaco@hotmail.com?
    I’m racking my brain to construct a component of a report to my boss asked.

    tks
    Adilson (from Brazil)

  112. HI plz share the source code

    rahultnath@yahoo.com

  113. Mehmet bay on said:

    HI plz share the source code
    bay_mehmet80@hotmail.com

  114. Anoop Singh on said:

    Hello Sir,

    i am working on a image splitting project, so i have to split a large image into many pieces(A3,A4,Letter). after that i have to send all split pieces for printing. but it will working only in firefox & internet-explorer, not working fine in google chrome.

    so i need your source code to implement the same code in my project. please send me the full source code with any available example on this mail id–>

    garg_ashutosh@live.com

    please send it urgently.

    Thanks & Regards
    Anoop Singh

  115. Keith Gerhartz on said:

    Could you please forward a copy of the code and any documentation that you might have. Thank you.

  116. abhishek on said:

    can u send code for flex 4.6 sdk ?
    PDF not working in it
    abhishekchess1@gmail.com
    :)

  117. Siyabonga on said:

    Hi, what an amazing component! Great great work! Can you please send me the library on this email: paren.tipesca@yahoo.com. Thank you in advanced!

    • Siyabonga on said:

      Hi Avenir, thank you for your prompt reply and thank you for the code. I really appreciate it. Keep up the good work, God bless.

  118. Great work… Can u please mail the complete source code??

  119. Aaron Nash on said:

    great demo, can you please send the library’s. Would love to use your reporting tools

  120. i would like to request the source code please email it to spicyradio@hotmail.com. I would like to add one question, does this only work for DataGrid? I wanted to know if i can use this to generate/print all my contents in a SCROLLER rather than a DataGrid?

    • Avenir Ace Cokaj on said:

      It is just for a grid, i don’t think it can help with list or renders.

    • Is it possible to request your assistant with this source? What i need assistance with is the orientation, i just switched it over to use PrintDateGrid instead of AdvancePrintDataGrid, the only problem i am having is that my DataGrid has about 35 datafields, and when i generate the PDF file everything looks jammed up, how can i correct this either using landscaping or another method? I just need to get this to fit somehow.

      • Avenir Ace Cokaj on said:

        What i would suggest is you could separate your columns in many print jobs this way your columns are not smashed all together. There is no solution to fitting 39 columns in a single.

  121. jahan zaib on said:

    Hi, please can you email me the full source project , so that i can quickly see how to integrate the tool with my project. thnks

  122. Hi,
    Can you please send me the source code to this email: sunilflexi@gmail.com. Thank you in advanced!

  123. Vaibhav on said:

    Avenir, this is great!! I would absolutely love to see the source! vaibhav490@rediff.com
    Thank you!
    Reply ↓

  124. Nitin Gopi on said:

    Hi I was searching for this component. Please send it to my email address.
    Thanks

  125. Nitin Gopi on said:

    Hi
    I was searching for this component.
    Thanks

  126. Hi , its a great work.. can you please send me the source code to this email.
    Regards

  127. Donald on said:

    I need your source code. Thx.

  128. Chad Fraser on said:

    Hi Congrats you project is one of a kind, i will love to have it in my project. Can you please send me the source code.

  129. Need to open the generted PDF in same application not in another window.

  130. Great Job buddy

    Can you provide me with the full Source and attached components (swc) if any ??
    I am very please to run it.
    Thank you for your help

    Regards
    David_L

  131. Please send me the code to smurf2312@hotmail.com Thanks for the good work.

  132. could it be possible to create the pdf with link to other documents ?

  133. Please send me a copy of the full source. Thx in advance : )

  134. Great work, Can you please send source code to rarfoxi3.tj@inbox.ru

  135. VICKRANTH on said:

    Please send me a copy of the full source. Thx in advance : ) vickranth.navalar@yahoo.com

  136. jose on said:

    Great Work !! can you send the link of source?

  137. subash on said:

    Great work. Can you send source file to subash@keyslab.com

  138. Kritian on said:

    Great… :) ))
    Please send me full source code…
    Thank you!

  139. Johnny on said:

    Please send me full source code…
    Thank you!

  140. Madhusudan Dutta on said:

    hi, can u send me the source code of this? then it will be very helpful for me also. i’m using IBM elixir task chart,resource Chart to print.
    thanks..

  141. Hicham on said:

    Awsome Job,
    can i have the full source code too?
    my email is hicham@surfaumaroc.com
    TX

  142. Genaro Pinson on said:

    Thanks for this. Can you please send me the source code and sample as well? Thanks a lot in advanced.

  143. Loved the example, great job! Can you please send me an example on how to implement this? tunay_sr@hotmail.com

  144. PDeo on said:

    Could you please send me the source code? Really appreciate it! KEep up the good work.

  145. Hello. Can you please send me a copy of the source code. I am actually interested in the PDF generation piece, as I am trying to figure out the best way to download a PDF from the web server and print it through flex.

    PS: I know I can do it by using an iframe in the browser window that is hosting my flash component. I.E.: load the PDF in an iframe, and then invoke the browser “print()” command. But, for reasons I won’t get into, I need a solution that does not use the browser or javascript interfaces.

    Thanks in advance.

  146. Please send me the full source code to dd@drummond.id.au

  147. Ravichandran J on said:

    Hi,

    Thanks for developing an essential component. Please email me the source code at ravichandran.j@v2softindia.com

    Best Regards,
    Ravichadnran J

  148. Deepak Ku Patel on said:

    really it is greate job,can you send the complte code.

  149. fernando on said:

    Pls send the source code project to my email address fernandobande@hotmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

HTML tags are not allowed.