.NET Core PDF and RTF document generation - c#

Looking for suggestions for libraries that can generate PDF and RTF documents from stored data (not "HTML to PDF" or "URL to PDF"). With all functionality for adding images, encryption etc. We are currently looking for an alternative to PDFSharp-MigraDoc-GDI, which, although works with .NET Core, does not fully support it and we see compiler warnings - "This package may not be compatible with your project". We have also been getting issues on the IIS tier regarding GDI+. We've decided to play it safe and find an alternative. Does anyone have a solution that they would recommend? Thanks

As far as I know, you can write whole new documents using the Microsoft.Office.Interop library, here is this post that's talk about it (be careful about deploying things like these, you might need an office instalation running on the server):
https://www.c-sharpcorner.com/UploadFile/muralidharan.d/how-to-create-word-document-using-C-Sharp/
And I've found this post about using the library to print PDFs:
How do I convert Word files to PDF programmatically?
It's not much but hope that it helps, regards!

Related

How to Add and update the comments for the PDF file using c#

Now I am working in the process of Insert and Update the comment for the pdf file using c# code. I want to Know the any possible way to insert a comment inside the pdf file. Anyone Know about this, Please reply and some reference for this process.
Microsoft does have very limited support for PDF in operating system APIs and it has come only recently in Windows 8 for modern applications (now called UWP) and that support doesn't go as far as updating comments.
So you need to use the 3rd party library. As far as I can tell SharpPDF is the only free library worth something, but I failed to open many PDFs in it so I can't recommend it. So I think you would need to search for some commercial library, I am aware of several of them that can do the job (e.g XfiniumPDF, iTextSharp etc) and you'll get the documentation when you license them.

Generating an Excel File Example for Visual Studio 2010 and ASP.net and C#

I've come across ExcelPackage and I found a couple of examples of using it, but none seem to work, they've all got some aspect, component missing or are for a different version of Visual Studio. I simply need to generate a .xls or .xlsx or even a .csv file, but as I am using a 3rd party server I can't use the Office .com objects. I have used SpreadsheetGear in the past which is expensive and as I am retired, I can't afford this sort of product.
If anyone has a working example of ExcelPackage or any other freeware offering, or can point me in the direction of one that has everything I need, it would be appreciated. A regular Web App rather than MVC would be preferred.
Take a look at Simplexcel by Michael Stum. It is designed around simplicity, is fully supported under ASP.net and should allow you to make simple, but extremely usable Excel cheats. You have an simple example available here.
Check out the Open XML SDK. This gives you the ability to generate and manipulate Office documents without using Office itself or the interop, and as such makes it a suitable approach from the server-side.

How can I use DOT files to export data's?

I need to export data into a word doc using ".dot" models, with an application written in asp.net.
Can you give me some links to learn this trick? I'm sure is it possible without any external libraries.
Thanks to the universal knowledge ;-)
I doubt you will able to do this without any extra libraries.
If you are using Word 2007+ format (eg .docx, .dotx) you can use the Open XML SDK. If not, your best bet is probably Aspose.Words
You'll need to have MS Word installed on the machine that will fill the templates (.dot files), and then you can call an instance of Word to do the replacements for you, using Microsoft.Office.Interop.Word.
If this has to be implemented on a server, you might have a problem. Microsoft advises against installing Office on servers because of stability and reliability issues. http://support.microsoft.com/kb/257757 focusses on some of these problems and also mentions some alternatives.

Highlighting PDFs programatically in .net - are there any APIs or Libraries to generate offset file or is there a better method?

I need to programatically highlight PDFs on the fly, preferrably using the highlight file method.
Are there any .net programming libraries to generate a xml highlight offsets file for a pdf? Doesnt have to be open source or free.
I tried converting PDFBox to a .net DLL using IKVM and it did not work correctly. Im not terribly excited about the memory footprint of the entire java class library in the DLL anyway.
a second option would be to regenerate and highlight the source PDF, if there are any libraries / APIs that will do this to a PDF relatively easily that would work too, but I have not found any in my searches.
thanks in advance.
I dont know if this has solution for your requirement, but this is a good opensource api to work with PDF. I will be so happy if it could help your needs.
http://itextsharp.sourceforge.net/tutorial/index.html

Generating a Word Document with C#

Given a list of mailing addresses, I need to open an existing Word document, which is formatted for printing labels, and then insert each address into a different cell of the table. The current solution opens the Word application and moves the cursor to insert the text. However, after reading about the security issues and problems associated with opening the newer versions of Word from a web application, I have decided that I need to use another method.
I have looked into using Office Open XML, but I have not found any good resources that provide concrete information on exactly how to use it. Also, someone suggested that I use SQL reporting services, but searching for information on how to use them, lead me nowhere.
Which method do you think is the most appropriate for my problem?
Code samples and links to good tutorials would be extremely helpful.
Thanks for all the answers, but I really did not want to pay for a plugin and using Word automation was out of the question. So I kept searching and eventually, through some trial and error, found some answers.
After throughly searching through Microsoft's site, I found some newer articles on the Office Open XML SDK. I downloaded the new tools and just started going through each them.
I then found the Document Reflector, which creates a class to generate XML code based off an existing Word Document (.docx). Using my Label Template Document and the code this tool generated, I went through and added a loop that appends table cells for each address. It actually proved to be fairly simple and way faster than using Word automation.
So, if you're still using Word automation check out the Office Open XML tools. Their surprisingly extensive for a free download from Microsoft.
Office Open XML SDK 2.0 Download
I use the Words plugin from Aspose.com to do mail merges (programming guide).
You can take a look show 137 and 138 on dnrTV (www.dnrtv.com). In these video's Beth Massi shows how to do some editing and mail merging with OpenXML. She does this by using the Open XML SDK and xml literals in VB. It requires no third party components. Also it doesn't require MS Office to be installed on the machine.
This video inspired me as a C# developed (and no VB experience) to do some XML manipulation in a separate dll in VB. I call into this dll from my C# application.
It is worth a try.
We have the product Aspose that tvanfosson has mentioned. The edition that we purchased works with SQL Reporting Services so it can be used with the scheduler for creating output. It is really a great product and we used in a system that needed to support Korean characters in the final document. It works great and was under $1K with support. Not bad.
The advantage of using a product like this is that you can continue to manage your data and the skill set required to produce the documents is at a level where a variety of developers can support its use.
Vanstee,
If you really want to do this in code, check out this post I just found on Google
http://kellychronicles.spaces.live.com/blog/cns!A0D71E1614E8DBF8!1364.entry
If you are using reporting services cant you just move the information in the word doc into a database table and read it from there, taking word out of the equation?

Categories

Resources