.NET Windows Form Data to PDF - c#

I have a C# .NET Windows Form with text fields. The user enters data into this form and once they submit I need to generate a PDF file with their data arranged neatly. What is the best way to do this? Should I move the data into a database or can I directly export to PDF?

There is no need to add it to a database if you don't want to persist the data for later use. There are tons of libraries out there for pdf creation in c#.
Here's a post made not long ago with some great references. It also covers almost the same topic.

you want to export directly to pdf. are you have any specific format, how it should Looks.
otherwise create a crystal report. Design a format.After that write this code
Crystalreportobject.ExportToDisk(ExportFormatType.PortableDocFormat, name + ".pdf");
ExportToDiskMethod can Export directly to PDF

Related

Generating PDF with signature input and run script when filled

I have a sample PDF. I want to manipulate it with data (add fullname + date) and add a signature field. When the user opens the PDF on his browser and signs it, I want to save the pdf to my database and get notified on my backend side (when success).
I am familiar with php; thus I came across with 'fpdf' and 'tcpdf'. However, I couldn't figure out if what I want achieve is possible with those, but I don't think so. I can open pdf and add line from fpdf but I can't achieve anything with signatures.
What is the best/easiest way to achieve what I want to achieve? From php am I capable of such thing?
Should I try to generate the pdf from html? Is it possible to achieve what they are doing with C# in php? Or should I use completely different language for such thing?

Add to MSSQL from PDF form

I have a PDF form which is used for the purpose of creating inspection reports.
I am currently using a c# WinForms GUI to accept data from users, insert this data into an MSSQL DB, and populate said PDF Form. The latter is achieved using the iTextSharp library.
I have been receiving requests that the process be reversed, whereby, the users enter the data into the form, for a more visually appealing interface, then, through means of a PDF button or something similar, take the data from the form fields in the background, and save it to the DB.
So the flow would be:
Users populate PDF Form > Button clicked > Data saved to DB > PDF Form saved to local machine.
Can anybody recommend a way of acheiving this? If there is a way of making PDF Buttons invoke C# scripts, that would be ideal, as I could simply have the button save the form, and then invoke a script passing the form filepath as a parameter.
Thanks in advance.
My preference would be to use a web interface or, as HighCore mentioned, WPF.
Acrobat does allow for a database interface with PDF forms. Look here at Adobe's website. The other option is that PDFs support JavaScript so you could use that to post data to a web service.

Generate PDF based on a Word document for each data item

There're a data list with hundreds of data items (suppose each item is a customer), and a predefined word document as template, the requirement is - for each data item, fill corresponding data into template fields, and generate a readonly PDF file as result.
Prefered platform is ASP.NET with C#.
I found two solutions:
Change the word document into a PDF form, and use iTextSharp to fill the form fields. But create the PDF form with correct format (font, layout, etc.) is a difficult work, and it needs particular tool and new skill when system user wants to add new template (unless the PDF form is always created by developer).
Add text placeholder in the word file, and the program can read word file, replace text, and convert into PDF. But I'm not sure which components should be used.
I'd like to get some advices on this problem. tks.
Update 20130416:
After some searching & experiments, my conclusion is below:
Client solution: use Microsoft.Office.Interop.Word (Office2007+plugin or Office2012) to read data, convert to pdf, etc. But this method running on server side may be unsafe.
Server solution:
Make PDF form, and use iTextSharp to fill the form fields. The disadvantage has been mentioned above.
Make HTML template, and replace field placeholders, and use iTextSharp+XMLWorker to convert HTML to PDF. The difficulty is create the HTML template manually and optimize the PDF effect.
MS SharePoint Office Automation Service is a server solution based on MS Office, perhaps this method will be easier, but it needs license and SharePoint server cost.
Finally, I chose the HTML template solution for this request. QED.
Another option would be to use Tx Text Control for ASP.NET. They have a
mailmerge feature that allows you to fill data into a word template.
The merged document can easily be saved as a pdf.
For the second option you can use iTextsharp or Aspose which supports the placeholder replacement and generation PDF, it supports creating files based on templates of MSWord and Openoffice which could be usefull for user who do not want to buy MSWord only to create a template.
Another option, you can use nustache templates, fill them with list data and then use xmlworker from ItextSharp to render to pdf.

iTextSharp or XSL-FO to create a PDF dynamically with fillable forms?

This is my first stackoverflow question.
After days of research, I am still lost on how this can be done, if its even possible.
I am trying to create a PDF document using either iTextSharp or XSL-FO (FO.NET is what I am using currently). Creating the documnet is no problem. I need this documnet to have fields that the user can still fill in.
I am aware of the ability to create a PDF form using acrobat, then using iTextSharp to fill in those fields. This can then be saved and the user can open the document and edit it.
The problem with this is, anytime the PDF "template" needs to be changed, someone has to edit the PDF document, then change the backend logic to handle the new field.
I am looking for a 100% dynamic solution.
Ideally I would use XSL and FO to create this document without the need for an exisiting PDF document. I have found no way to create a fillable form using FO.NET, or even iTextSharp, without already having an exisiting PDF "template".
Thanks in advance.
I believe both the RenderX XEP and Antenna House FO processors support PDF Forms. They aren't free and additional output modules may be required for PDF Forms.

Filling out a PDF / form using Winform application

I have a 2-page PDF that I want to overlay information on (think of a form that someone manually fills out) using a C#/.NET Windows application. After this form is generated, it will need to be previewed and printed (exported into a graphic or PDF is nice, but not a requirement).
At first glance, I'm thinking of two ways to do this:
Use a PDF manipulator like iTextSharp, take a copy of the blank PDF form, and add text to the PDF. Then, launch Adobe Reader to do a print or preview.
Convert the PDF into a graphic, and put the graphic into a C# Report. Then, overlay text fields onto the report, and use a .NET ReportViewer control to preview and print the report.
The text does not need to be searchable or copyable or have any of the cool things that PDF gives me, so I'm leaning towards the second option. Am I missing anything, or is there something I'm not thinking of? Thanks in advance.
We use #1 extensively and it works perfectly. You shouldn't have any problems, it's rather easy (just need to make the fields writeable and use a FDF file and merge it with the PDF file). At least that's how we did it.

Categories

Resources