Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

.NET program to create PDFs

Avatar

Former Community Member
Hi everyone,



I'm a .NET developer that would like to write a program that takes information from a SQL Server database and writes it out to PDF files. I would like to use LifeCycle designer to create editable PDF files and call an API to populate the forms. What is the best way to do this? Is there a .NET/Windows API or XML solution for this? What's the best approach to take? The software I'm writing is for a low-income clinic that has absolutely no internet access so any Web solutions are out of the question. I'd REALLY APPRECIATE any help you can give me. Thanks!!!
9 Replies

Avatar

Former Community Member
Unfortunately there is no solution for this that doesn't involve Adobe's server products, which sound like they'd be out of the question for the project you're working on.



--

SteveX

Adobe Systems

Avatar

Former Community Member
I finally got a chance to download the Lifecycle designer and play with it. There is a tutorial - "Quick Start 4 - Creating a Dynamic Purchase Order Form" that shows you how to use a schema and XML data to populate a form with data. This seems like exactly what I need. I could create an XML data file from my application and then launch the PDF file that references the XML file. However, I could not get the form from the tutorial to actually show the data. Since I'm using the demo of Lifecycle Designer, the F5 button is disabled. There is a checkbox in File/Form Properties/Performance tab that says "Requires Server Side Binding/Scripting" which I unchecked. I tried loading the form in Acrobat Reader and I got an error that said, "Unable to Repair File". Can you please tell me what products I need to get Lifecycle Forms populated from XML files to work?

Avatar

Former Community Member
Hi Sandy,<br /><br />The check box you mention is only applicable if you are using the form in conjunction with LiveCycle Forms. Looking at your initial email and taking into account your limited funds it may be easier to design your form so that it pulls the needed information directly out of your SQL server database into the form using an OLEDB data connection. If you are set on using XML files then you can import the xml data by placing the following javascript in the initialize event for the form. <br /><br />xfa.host.importData("<path>/<file name>");<br /><br />This particular function has security restrictions upon it. If the PDF is not certified by a trusted digital id then you cannot specify a file name when calling the function. Instead it will display a open file dialog to the user of the form. If the PDF is certified by a digital id that is trusted to execute javascript then you will be able to specify a file to be open.<br /><br />I have attached a simple example demonstrating how to import XML.<br /><br />Denver Green<br />Adobe Enterprise Developer Support

Avatar

Former Community Member
Have you tried ASPPDF yet

I have been using it for a while to fill out forms created in Designer

and it works really well.

Avatar

Former Community Member
Hi Denver,



Thanks for the info. I definitely like the XML approach rather than pulling data directly from the database. I was able to get the button to work inside the designer preview, but I couldn't get the import data command to work in the Initialize event. I couldn't get it to work in your sample either. I get this error:



"Script failed (language is javascript; context is xfa[0].form[0].form1[0]) script=xfa.host.importData(""); Error: $host does not have a method 'importData'



Maybe the initialize event occurs before host is completely set up?



As for the button, I passed blank for the file name but it still didn't work in Adobe Reader (I have version 7.0.7). It does work in Acrobat Professional. Any ideas?



Meanwhile I've been playing with Acrobat 7.0 and it is so much easier to create editable PDFs with this tool. It doesn't give me all the missing font warnings and mangle text. I don't suppose there is a way to import from XML and link up fields like you do in Lifecycle? If not, I guess I will first create the text fields in Acrobat, open the file up in Lifecycle and link up the fields to the XML document.



Thanks for your help,



Sandy

Avatar

Former Community Member
Hi Sandy,



Make sure that the script language is set to Javascript and not Formcalc in the script editor pane.



Denver

Adobe Enterprise Support

Avatar

Former Community Member
Hi Denver,



I confirmed that it is set to Javascript. I also checked to see what version of LiveCycle I have. It is Version 7, 0, 041126, 0. It is the Adobe Design Tryout 7.0 so maybe there is a later version that isn't in the eval download?



Thanks,



Sandy

Avatar

Former Community Member
Hi Sandy,



Your right I think the problem is the initialize event. Try moving the code to the docReady event.



Denver

Adobe Enterprise Developer Support