I have a web page in which user has to enter many details.
I want to fetch the records that are being entered by the user and generate a pdf file, and also preview it in a browser.
I also want to save the pdf into the database.
Can anyone help me to understand how this process should start?? I mean how should I proceed?
I am using Visual Studio 2008 and mysql. I have adobe reader installed on my system. What else do I need?
Can I get the tutorials or code samples which will help me.
thank you
Adobe Reader is just what it says, a Reader application, and will not help with generating a PDF. I recommend you to have a look at iTextSharp
You'll need a third party library for the pdf generation, such as Report.net or ITextSharp.
The problem I see with browser preview, is that I don't know of a good way of doing it. If you just want to show them the data that goes in to the PDF, then just displaying that on a web page is easy enough. The problem is previewing the actual PDF. That will require the user to have some sort of PDF reader installed, and it will also require that their browser opens the PDF automatically and doesn't try to save it instead. It also has the problem of how the user will "get back" to your website once they're done with the previewing.
Related
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.
I'm looking for the best way to display pdf document on a website. Surely I need to convert it to jpeg or gif for the browser to handle it. I read few posts but most refer to GhostScript and its pdf2image. But that solution calls for starting a process that would save a copy of pdf doc to the file system and then would have to be loaded back into memory for displaying. Frankly I find it a bit clumsy. For those of you who have done it, what library you used and if you could attach a link to some examples, I'd greatly appreciate it.
I'm developick a web application that helps manage manufacturing process and is accessed fron android tablets. Company has a stockpile of documentation in pdf files that is to be delivered to production managers. I'd love the solution to be akin Crystal Report Viewer contron but I I understand that I have to stick to pdf to image conversion. Please give me some advise here.
My advice is don't over think this.
You can simply add a link to the PDF file, which will open on a new tab.
You can take a look at http://mozilla.github.io/pdf.js/ which will allow you to render a PDF on the client side.
Or if you decide to go with a Ghostscript, you can take a look at http://ghostscriptnet.codeplex.com
By all accounts the PDF Focus .NET library seems to be the best solution. A wrd of advice is to add a cleanup method to the page unload to delete all temporary files that were used to feed source into image controls when displaying pictures on a website.
I'm using EPPLUS to allow users to download data to Excel.
However, I'd like to add a feature wherein they can just choose to print this data rather than download it. Can we issue a print command from EPPLus?
It is a web app
Ah, so there's the main problem... You know, even if EPPlus had a method for printing, it wouldn't help you, because it would try to trigger a printing dialog on the server-side, but you need to send the file to the client over the internet. So I'm afraid the answer is no, the client surely has to download the file either way to be able to print it.
Furthermore, xlsx can't be that easily opened in the web browser (compared to pdf for instance), so the solution to somehow trigger a printer dialog on the clients pc will be a tiny bit difficult. C# can't trigger anything over the internet with asp.net because of the security problems and I'm not really sure if javascript has enough permissions to open an application for Excel file and start the printing process..
Maybe your solution would be to create a PDF file instead of XLSX, send it to the client as a part of the website/response and use javascript to print the file. PDF can be opened in most browsers nowadays and we have a nice js function printWithDialog(). I believe this doesn't work for xls and it certainly doesn't fulfil your requirement "without download". The client has to have the access to the file before he can print it, you can't overcome this.
I want to know how I can view a PDF through a C# .net desktop App. I am trying to create a application to view PDF using visual studio 2008
There is a pdf reader libraries called iText(iTextSharp). But it didn't help me
You can host a ie web browser control in your application and that will allow the user to view a pdf if they have a reader installed.
I can provide an example if you tell me whether you are using WPF or WinForms.
Drag WebControl on to you form
Set the path in code
Done Press F5
I'm not sure what netbeans has to do with anything, but take a look at this question here How to render pdfs using C#
Essentially you need to get a 3rd party PDF viewer or write one yourself. There are quite a few around and would probably take a look at something like PDFViewForNet
iText isn't a PDF viewer.
If you want to read PDF documents in your application there are couple of Open Source PDF Libraries.
I'm looking for a way to display a PDF (similar to a picture box), in a Windows Form. After that I need to be able to create a PDF. What's the best library for the job for creating the PDF (from simple text)? I've taken a look at several and I'm not sure which one is the best. Preferably open source. As for the control, I tried the COM object Adobe provides... I can't seem to get it working. At all. I've tried loading several files, there are no errors. It simply fails to load.
PDF Sharp, Sharp PDF and iTextSharp are excellent. They are all OpenSource.
To answer your question about getting the PDF to render, you could use a WebBrowser Control on your form as long as the client workstation has Adobe Reader installed. The browser will automatically pick up the MIME type and load the in-browser Adobe Reader.
For rendering, I echo Will Marcouiller and SLaks. We have had good success with PDFSharp.
For creating pdf's iTextSharp is very good, and it's free too.
I worked with SharpPDF and it did great job. And it's open source.