Create dynamic PDF in Flex - apache-flex

Trying to understand from a high-level how this would be accomplished.
Use case:
Flash application embedded in HTML used to create Certificates (just an example).
User enters a bunch of data into a form (Name, Address, What certificate is for, etc.).
User clicks a button which causes the application to create a Certificate in PDF form, with the form data displayed in a format that I define with a bunch of different images).
Ideally, Flex could use the browsers functionality to prompt the user with "What would you like to do with this document, 'Download', 'Open'. So it would function just like clicking on a link to a PDF document inside of a web page.
I already have the form and everything, its just a matter of how I create a PDF from that data. Is there a certain function that can take the current screen and create a PDF image of it? Or is there a certain library for creating PDFs? If anyone can point me in the right direction it would be much appreciated.

There is a AS3 PDF generator library called AlivePDF and can be found here.

Purepdf
is another actionscript library for creating Pdf file.

Related

Editing PDF document online and save in the database using ASP.NET

I have a PDF document storted as binary in the SQL Server database. I have rendered the binary document as PDF inside an iFrame using HTTP Handler.
Now, I want to allow the users to edit the data in the PDF file shown inside the iFrame and also populate some of the fields in the PDF automatically on clicking a button.
After all the fields are populated, the filled PDF document in the iFrame should be saved back as binary in the database.
How can this be implemented using ASP.NET 4.0?
I think you're looking for http://www.radpdf.com/
I have implemented this by adding HTTP Submit button inside the Adobe Acrobat (interactive) form. When the submit button is clicked, the PDF document will be posted to the server (an ASPX page). ASPX page will read the PDF document posted as stream, convert that into bytes and store in the database.
This is the difficult part of your question:
Now, I want to allow the users to edit the data in the PDF file shown inside the iFrame and also populate some of the fields in the PDF automatically on clicking a button.
You're going to need a third party tool that provides an API for filling form fields in a PDF. There are a few cheap ones and a few expensive ones. The only ones I've ever used successfully are
activePDF
Aspose
But there is also some open source projects:
iText ("iTextSharp") (example)
These tools can be used to fill in the fields of a PDF, as well as for other basic edits to PDFs, but things like editing text outside of form fields is very tough to do. There are entire software suites built around PDF authoring (think Adobe Acrobat). They should all provide ways to give you the new PDF (as a file, a byte array, a stream) so you can persist it back to the database.
You might have better luck allowing users to download and edit Word documents (or whatever equivalent you choose) and converting the end result into PDF. Aspose again could help with filling form fields in a document as well as the conversion from Doc to PDF.
I am not affiliated with Aspose in any way -- it just seems to be the tool of the trade for these sort of tasks.

How to preview a word document or PDF using asp.net?

I have a list box that contains a collection of documents that a user has uploaded. I would like to make some sort of preview window on the page that allows the user to see the document without having to download it and open up word or reader. Can this be done?
One word answer: yep
Many words answer: for the PDF viewer, you'll basically need to use a PDF library (ABCPdf, etc) that allows you to generate an image from a PDF on the fly that you send down to the client. For word, there could be similar functionality in VSTO.
Another solution is to use Scribd API to handle all the dirt work for you. That way your users can view their docs in the nice Scribd doc viewer.

Relative Links in PDF

Need some advice on what course of action to take next.
Have written an ASP.Net application. Part of the application deals with being able to view PDFs. The initial PDF viewed acts as an index to access other PDF documents. You click a link in the Index PDF and it jumps to another PDF file. Legal documents, agreements, etc.
This scenario works on some computers and on others it doesn't. I managed to figure out what the problem was. On some of the computers the initial Index PDF was being hosted within the browser and on some other computers it was actually jumping out of the browser and directly into Adobe Acrobat. As soon as the PDF jumps out of the browser and into Acrobat the relative links in the Index PDF stop working because it is hosted client side via Acrobat but the additional PDFs it is trying to access are on the server.
I figured out why some computers stay in browser and why some jump out. There is an option within Acrobat itself that determines this behavior. It is under Edit--> Preferences ----> Display PDF in Browser.
I am in a jam because I am not in control of the PDF documents themselves and how they are written, and I obviously have no control over the options selected in Acrobat on each and every computer. My problem is also compounded by the fact that our firm has just recently purchased a new PDF reader called Nuance that will be pushed out firm wide soon and I don't think it even has the option to have PDFs hosted in browser.
I can get what I need to work if I create the index in HTML, but the problem is I don't write the Indexes and the people who do are not trained in HTML. I can get the people who write the indexes to change from relative links to absolute links, but then I run into the problem of what if we change where we are hosting the PDF files? All the links will break again? I think we are stuck with relative URLs, but how can I make it work?
I am thinking about maybe hosting the PDFs within Silverlight?
Looking for any thoughts or ideas?
Thanks.
Silverlight isn't going to help you here.
The solution really is in finding a better way to create the index document. Just how sophisticated is the index document content anyway?
If you don't want to have to train the authors of these indexes in HTML then can you provide them with a simple tool that they can use to describe the content. You could then have code server side to generate the HTML (even PDF) dynamically.
What you need is a simple redirector ASPX page whose URLs you can use in the PDF documents. Put the paths of the PDFs in a database. Give an ID for each PDF. The ASPX page should accept the ID as a parameter, do a lookup on the database, and response.redirect to the current location of the PDF. You can use URLs based on this ASPX page in the PDFs. If you keep database up to date, then the links in the PDF documents will always lead to the correct location.
In the Database
http://someserver/somepath/abc.pdf
ttp://anotherserver/apath/sdf.pdf
Links in the PDF documents
http://yoursite.com/pdf_redirect.aspx?id=1
http://yoursite.com/pdf_redirect.aspx?id=2

Any way to save a graph as PDF using FusionCharts 3.1 inside a Windows Service?

I'm working on an asp.net website that uses FusionCharts v3.1 code to render graphs as swf files.
I need to write code to allow users to re-create and email these graphs on a scheduled basis. Our product uses a service to take care of scheduling and email events so I need to modify the code to first render the data as a graph, save it as a PDF, then attach it to the email body. All this must be done in the service so no UI will be available.
Anyone know if IE can be loaded and display a shockwave object if there's no UI available?
This is Subhayu from the FusionCharts team. Maybe I can offer you some help. :)
Saving the charts as PDF files is as easy as cake. Check out the following link for detailed steps on how to export the charts as PDF and save it directly to the specified location.
Go to www.fusioncharts.com/docs. Using the nav bar on the left go to Exporting as Image/PDF > Server-side Exporting.
For your second query on how to just create the chart image without using any interface(without rendering it to the client side), we have a demo on how to do exactly this in .NET 2.0. Please provide your e-mail id on this post so that we can provide this demo to you. Or you can optionally send a request to support[at]fusioncharts.com.
Hope this helps. :)

ASP.NET component that allows online Annotation of PDF files

We are trying to develop an application to view and annotate PDF files in ASP.net.
The function involves capturing x,y coordinates from a click and placing the annotation on that specific location.
Are there available components to do this?
Thanks in advance.
I am not sure I have enough information to provide a specific answer to your question, but perhaps this info can get you started...
If I understand correctly, you are going to provide some UI that will enable the user to point to the location of the annotation when viewing the document, then you will modify the PDF on the server, and render it with the annotation at the point selected by the user.
Perhaps one way you can capture mouse input to enable the user to select the location of the annotation is to render an image of the PDF document page and show it on the page, and then capture the mouse location on a click event.
Then, if you have the annotation and the desired location, you could use a PDF library to update the PDF and draw your annotation into the document on the specified page at the specified X,Y coordinates.
We are using a PDF generation library that we are very happy with to render PDF documents on the web server, which we deliver to the browser via our ASP.NET application.
You might want to take a look at this product and see if it can meet your needs:
DynamicPDF from ceTe software: http://dynamicpdf.com/
Hope this helps.
We are also looking at this and found this Java applet which does the job very well.
I've used iTextSharp in the past, to annotate PDFs of Piping & Instrumentation diagrams - worked rather well.
We have also looked at jPDFNotes at qoppa, and had good results with it.

Resources