As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I have a digital certificate that identifies a user. I need to use it to Digitally sign pdf files.
Does anyone have an example that does not uses a third party component? I need to get this done but it would be nice to fully understand how things are done.
C# Examples please :)
The open source iTextSharp library will allow you to do this. Here's a post explaining how to digitally sign a pdf file. If you don't want to use a third party library then you can implement it yourself but it could be a tough task -> you can start by reading the pdf specification (8.6MB)
Proper PDF signing is a very sophisticated task. There exist a number of files that don't conform to the PDF specification (broken xrefs etc) and your code must handle all of them. Then various Acrobat versions treat certain things in signed fields differently. So if you need to do the task (rather than study how it works) you should rely on third-party solution, such as our PDFBlackbox components.
Digitally signing a PDF document without using a third-party component entails a great deal of work and is generally best avoided.
Components do all the hard work for you, so you don't have to. You should find there are some excellent free PDF components available that will suit your needs.
The following example written in C# shows how simple it is to digitally sign a PDF document using ABCpdf:
Doc theDoc = new Doc();
theDoc.Read(Server.MapPath("../Rez/Authorization.pdf"));
Signature theSig = (Signature)theDoc.Form["Signature"];
theSig.Location = "Washington";
theSig.Reason = "Schedule Agreed";
theSig.Sign(Server.MapPath("../Rez/JohnSmith.pfx"), "111111");
theDoc.Save(Server.MapPath("Signed.pdf"));
Source: ABCpdf documentation - Sign method
Lost my first answer. May want to give DocQ a try to link text They have their own cert and can do this for you for free/cheap to seal and encrypt PDFs. They also have an API you can use.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Can you recomend any PDF API for C#. Free is the best, but I don't mind paying for it.
I used PdfSharp. It's free, open source and quite convenient to use, but I can't say whether it is the best or not, because I haven't really used anything else.
Update:
I'm not sure when or if the license changed for the iText# library, but it is licensed under AGPL which means it must be licensed if included with a closed-source product. The question does not (currently) require free or open-source libraries. One should always investigate the license type of any library used in a project.
I have used iText# with success in .NET C# 3.5; it is a port of the open source Java library for PDF generation and it's free.
There is a NuGet package available for iTextSharp version 5 and the official developer documentation, as well as C# examples, can be found at itextpdf.com
My work uses Winnovative's PDF generator (We've used it mainly to convert HTML to PDF, but you can generate it other ways as well)
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Anyone here knows how to generate PDF using ASP? My system is about car rental online. When user choose car,date and services offered, there will be a 'CONFIRM' button which it will generate PDFs after user click it. I don't ask for you to write me the code, I just need you to provide with some helps,tips and reference as I am not familiar with this. Looking forward to hear from you. Have a good ones. Cheers.
You can use ITextsharp from here http://sourceforge.net/projects/itextsharp/ it will help u to generate pdf.
And this tutorial will help u
http://www.mikesdotnetting.com/Article/80/Create-PDFs-in-ASP.NET-getting-started-with-iTextSharp
This is a list of free libraries that help you implement PDF generation in any type of aplication (including ASP) .
A bit of reading is required, but in the end its your choice wich one you are going to use:
http://csharp-source.net/open-source/pdf-libraries
From personal experience I can recomment ABCPdf.Net (paid) and iTextSharp (free)
Use EVO PDF
http://www.evopdf.com/
Or
Use Winnovative
http://www.winnovative-software.com
Use following to generate PDF it works with multilingual with great easy.. It is the best free dll i have used so far
WKhtmltopdf convert html file to pdf
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Is there a .dll I can use which uses a PDF file as an input and HTML file as an output?
I want to convert from PDF to HTML. My colleague says that it's very difficult going step by step, getting text/font/image/margins/links etc. from PDF and then creating new HTML file with the same content. He says it's nearly impossible. So I was thinking - if there's some dll which I can use as a reference to do that?
Writing a program to do it is definitely not trivial. If you don't find any .NET Library to do this (I couldn't, at least not free), I would just download this and invoke it programmatically to get my html.
If you have the time to spare and/or PDFToHtml does not produce acceptable output for you, you could use iText to write the program yourself. It's a very mature free pdf library. I've used it in the past to manipulate PDFs (merge, create, etc).
UPDATE
As noted in the comment by Quandary, the PDFSharp library offers a more relaxed license (MIT) compared to the Commercial or AGPL license offered by iText. Keep this is mind when choosing your library. I have not used the PDFSharp library myself and I don't know how they compare in terms of functionality.
You can download this free tool: PDFToHTML
Then in your program just fork a new process and run the executable passing the PDF file. I just tested it now and it seems to work ok.
If you don't mind paying, Aspose offers a very good solution, this is what we use at my company.
http://www.aspose.com/categories/.net-components/aspose.pdf-for-.net/key-features.aspx
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I have a few PDFs from various customers/vendors. My goal is that I am building a web app where a potential customer fills out a single form of data and then can generate all of the PDF's to print and sign.
The PDF's have fields in them that in adobe reader you can click and type in the data. However, this is sensitive financial data, and the PDF won't let you save to your desktop. There is actually a warning in adobe reader when you open the pdf and it prevents you from saving a completed form. I don't care about this feature. My users can save it if they want to take the risk if it becomes opened up when I generate the completed pdf myself.
The problem is that I need to generate these pdfs with my data injected into them without altering the style. I want to avoid manually building them, but I will if I have to. How can I generate the exact PDF format they gave me with the data filled in?
You could have a look at iTextSharp and the PdfStamper class - it allows you to load up an existing PDF, 'stamp' data into the fields and then flatten out the PDF which can be sent to the user:
http://sourceforge.net/projects/itextsharp/
Note that iTextSharp is paid for for commerical products - but there may well be other open sources librarires that can do this.
You may try Aspose.Pdf for .NET to achieve your goal. You can fill the form fields using this component. If you do not want to allow the users to edit this data once it is filled in the PDF, you may flatten the fields as well. This will not change the existing layout of your PDF. The API is very simple along with complete documentation and support.
Disclosure: I work as developer evangelist at Aspose.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to create a word file from a HTML content (on a ASP.NET server application) but couldn't find a robust way of doing that. So decided to run a discussion here to see what are possible options of doing this.
Aspose has a .NET component for this but the price is so high so can not be a solution (due to budgeting issues).
We expect this conversion to preserve tables, images, hiding invisible elements, links, etc.
There is a similar discussion here but solutions provided are all around Office Interop which is not a recommended solution for server application.
Any idea? Basically how do components like Aspose work?
Has the hard work already been done? There seems to be a project on codeplex.
Blog post describing HTML to docx converter
Project on codeplex
I would suggest writing code using the OpenXml API, you can navigate the DOM and programmatically add elements to the word document. Its no simple task through since you are interpretting markup and attempting to convert it.
link for Open XML: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5124
It's probably worth checking out Microsoft's own XSLT Inference tool which can generate WordML from XML input.
If you are flexible with the source of the document itself being HTML/XHTML/XML this could easily get the job done.
http://msdn.microsoft.com/en-us/library/aa212886%28v=office.11%29.aspx
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=3412
I've used it in the past to generate Word documents from within an ASP .NET app, which obtained its source XML data from SQL stored procedures.
The tool can be a bit temperamental, but with a little sanitisating of the XSLT that it generates it could just work.
If docx is appliable you can create a word document, save it as docx, reverse engineer the xml and create your own xml/docx. I did it with excel/xslx and it worked perfectly. To speed things up we created the XML as text and joined the strings (before our data - our data - after our data).
The RTF format is not a standard afaik but it is wide spread. Create an RTF document and return it as a word document. Word opens rtf without problem.
Create a HTML document and return it as a word document.
HTH