Generating fillable PDF as web form that can be submitted - c#

I am trying to generate a fillable PDF document that can be viewed in the web browser and filled up so after pushing a "Submit" button the data from the fields can be received on the server.
I am reading an article related with the iTextSharp but i still can not find a way of getting my mission accomplished. The example there is with a HTML form that after submitted the fields get binded to a pdf Template.
Is this my only option?

There are a few online options.
formsite - unlimited pdf generation for about $50, but you have to manually connect the fields.
doculicious - automated creation of embed-able pdf form
logiforms - same as formsite, but a little nicer and more options in other areas
seamlessdocs - very nice email/web pdf automated (still checking them out, but so far so good)

If you want to display a fillable form, and then store the values when the user submits it, you might be better off with just an HTML form. A basic HTML form doesn’t require any extra tools, and won’t get PDF involved. This is the simplest solution to your question. If you need to use PDF, and have to provide the user with a copy of the filled out form, please clarify in the OP, and I can provide you with a mode detailed solution.

Related

Save Form as PDF/Email to User C#/ASP

I don't really know where to start with this project. I've done a bit of research on here and haven't found exactly what I need. Essentially, I have a form that a user will navigate to, fill out several texts boxes/radio buttons. I have a submit button at the bottom that submits the data into my SQL database. I'm working in Visual Basic (C#/ASP).
After submission, I would like to include an option to save the webform as a PDF and an option, if possible, to email a copy of that webform to another user/group. I'm thinking the easiest way to do that would be to just include the save as pdf option and then the user can go to their personal email and do it that way.
Is there any basic "Save Webform as PDF" code template or any tips you all can give me? Feel free to post links to other questions/forums as I tried to read as much as I could over the past few days.
As always, thanks for any help.
Here is a page that shows how to create a PDF from textbox data using iTextSharp.
https://forums.asp.net/t/1906686.aspx?convert+aspx+page+into+pdf+and+send+the+pdf+as+attachment
This page shows how to send a PDF through email.
https://www.codeproject.com/Questions/459105/Convert-web-page-to-pdf-and-send-it-as-attachment
Good Luck!
Here are a few .NET libraries that will convert HTML or WebPages to PDF
PDFSharp: http://www.pdfsharp.net/?AspxAutoDetectCookieSupport=1
Free .NET PDF Library: https://marketplace.visualstudio.com/items?itemName=E-iceblueCoLtd.FreeNETPDFLibrary
iText 7: https://github.com/itext/itext7-dotnet
You could produce a receipt page and then give the user the option to convert that page to pdf for their records using one of these libraries.

Display "editable" PDF form

Working on ASP.NET db with SQL Server db. My client has several PDF forms. He wants me to transfer them to webpages so that the users can (1) load a pdf form filled with data from a database or (2) edit the forms directly and click a button to save it to the db.
For each "pdf webpage", I was thinking of converting the target pdf file to a jpeg then using that as the background image of the page. Then overlaying textboxes, checkboxes, etc... in the appropriate places. Then programming against the .net controls as usual. Do you have any better idea?
Thanks in advance!
Make the fillable forms available for download (showing in the web browser gets more and more tedious because the Acrobat browser plug-in architecture is less and less supported, and the browser's PDF viewing components are too dumb to deal with fillable forms).
Provide a Submit button on the form which submits the data back to the server. If you use the Submit method HTML POST, you can use the same server-side scripts as if it were a web form.
This means no fiddling with overlays etc.
And BTW, never, ever, ever use JPEG for non-photographical graphics.

QLPreviewController and UIWebView do not display filled PDFs

I have a PDFthat has text boxes in it. My program uses Xfinium PDF software to fill the text boxes. When I view the filled in PDF the document shows up with no data in the fields. I have tried using QLPreviewController and UIWebView and they both do not display the filled in fields; however, if I email the document to myself and open it in Adobe DC on the iPad all the data shows up correctly. It may be important to note that even the mail app does not show the PDF correctly filled in.
Here is the PDF opened in Adobe on iPad
Here is the PDF opened in UIWebView in my app (also shows same way in QLPreviewController
PDF forms may bring along appearances or may rely on the viewer to create an appearance for the value of the field.
Fairly complete PDF viewers (like Adobe Reader or Foxit) can get along with both variants well. Incomplete viewers, though, like many so called previewers, require an existing appearance and display empty documents for forms which do not bring along appearances.
Thus, if you want your forms to be visible on incomplete viewers, too, provide appearances.
The QLPreviewController use the CGPDF* API to display the PDF files. The CGPDF* API has some limitations, it displays only the page content and it does not display annotations, no matter if they have appearances or not. Form fields use widget annotations to display the field content so they are also not displayed.
The solution here is to flatten the form fields. This operation will transform the form fields into page content and QLPreviewController will display the final file correctly. The downside of this operation is that the form fields are no longer editable.
The XFINIUM.PDF library creates apearance objects for field values. The problem is related to iOS PDF rendering engine which does not display annotations and form fields. The solution is to flatten the form fields if you want to view the files using the QLPreviewController.
The form fields are flattened with this line of code:
pdfDocumentObject.Form.FlattenFormFields();
Disclaimer: I work for the company that develops the XFINIUM.PDF library.
Both QuickLook and UIWebView/WKWebView uses Apple's internal and undocumented CorePDF framework, which has no code that would render PDF AcroForms (doesn't matter if backed by appearance streams or not)
You can either
1) Flatten the document on the server or with a client-side library.
2) Re-implement everything from scratch and add support for PDF forms. (See Page 431ff in Adobe's PDF Specifications - "Interactive Form Dictionary")
We did (2) in the commercially available PSPDFKit SDK. It doesn't use Apple's rendering engine as you do not have a way here to render appearance streams for PDF form widgets, so even with a lot of code you'll not be able to get the representation that is encoded in the document. For this you'll either have to result to private API or re-implement everything yourself. We also support (1) using the PSPDFProcessor class.
Thanks,
It works for me.
pdfDocumentObject.Form.FlattenFormFields();
Bala.

How to disable download option of pdf file in c# ?

How to disable the pdf Toolbar because I don't want to give the download option to the pdf viewers.
I have used Iframe for showing Pdf File please find the following code
<iframe ID="iFrame2" runat="server" align="bottom" frameborder="2" name="iframe1" height="500" width="600" src="~/pdffiles/example.pdf"></iframe>
Please help me to disable the download option using c#.
Thanks
You cant. It is a browser feature which means you have no control over it.
You can use third party tools like Google Document Viewer or change the format of your document to an image.
Google Document Viewer
If you want to avoid that an end user saves a PDF document, you are asking something that is impossible. The only way to avoid that an end user doesn't have a copy of the PDF is by not sending him the PDF. A PDF can't be opened in Adobe Reader without having the actual bytes on the disk. Even if you would disable saving (for instance in the context of a web application), you'd always find the PDF somewhere in the temp files and people would be able to copy that file as many times as they want.
Trying to hide the toolbar (a viewer preference) doesn't make sense. Whether or not this viewer preference will be respected entirely depends on the PDF viewer. For instance: in Adobe Reader X and later, you have a special widget (HUD or Heads Up Display) that appears when you hover over the document. This widget allows users to save the document.
Let me quote Adobe:
the "Heads Up Display" (HUD) is not customizable. There are no APIs to
HUD. You can’t use JavaScript to enter Read Mode, exit Read Mode or
detect that the document is in Read Mode. Though it might seem like
it, this wasn’t an oversight. There are some very sound engineering
reasons why this is the case but I won’t go into those here.
Even with Adobe Reader 9, hiding the toolbar isn't sufficient: if the user chooses the appropriate menu item or hits the appropriate "hot key", the toolbar would appear and they could happily click the Save button. In addition, they could have right-clicked and chosen "Save" as well.
In short, you're asking the wrong question (and that probably explains the downvotes given by several people).

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.

Categories

Resources