Fill in PDF Forms from VB.NET application - vb.net

I am being tasked with creating a Windows application in VB.Net, and one of the requirements is to read data from an MSSQL database, and put in certain values into a PDF form. How can I achieve putting data into a pre-existing PDF file using VB.Net? Also, is it possible to put the PDF file in as a resource instead of calling it externally?

You may be able to take advantage of a 3rd party component like iTextSharp which is a PDF library. It's written in C#, but could be added to your existing solution as a separate project, or compiled and referenced as a library.
This library specifically references the ability to fill in PDF forms and should fit the bill for filling in your pre-existing PDF form programatically.

Docotic.Pdf library can be used for filling PDF forms.
There are samples for the library (C# and VB.NET versions available) that show how to:
Fill existing form
Find control by name
And you might find Write data from a database to PDF blog entry useful in your case, too.
Disclaimer: I am one of the developers of the library.

Related

Is it possible to automate Visio using a third party?

We are trying to create a Visio project file and to process it with an external tool to generate a json file that a web app can read to create a decision tree based on the json contents.
We know about 3rd parties to automate MS Word files but no idea if there are others dealing with Visio files.
Google didn't return anything valid as per Automation it always returns links to how to program macros on it.
Any help will be appreciated.
There are many ways to automate Visio: macros, .net plugins, python, pascal, even windows powershell.
But if your final aim is getting Visio to the web, you may try the following link.
http://unmanagedvisio.com/category/svgexport/
The tool exports the drawing to an SVG embedded in an HTML file with Javascript functionality. Definitely worth a look.

workflow for managing help content written by external co-workers

We develop a WPF application that has something like a context sensitive help. The content of the help pages is currently written as word documents by external colleagues (say biologists) and then translated to xaml code by developers. This process is tedious and error prone because the biologists don't see the xaml code and the word documents can't easily be diffed and tracked in a version control system.
So we'd like to improve this process and maintain the content in a single place, in a format that
is simple to edit (preferrably with a wysiwyg editor),
is stored in a simple ascii format (for diffing / version control) and
can be included automatically as a resource in our C# application.
The solution could be a framework, an external tool or any other idea.
The format should support simple html rendering such as bold and italic, superscripts, etc and images.
I suggest to use Flow Documents:
It is a WPF technology so you will use the well known tool.
Flow documents can be edited in RichTextBox WPF control. You can access an edited flow document via RichTextBox.Document property. Then you can save it into XAML file with XamlWriter. Taking all this thibngs into account you can easily and quickly create a simple application for your external colleagues.
Finally, you can load saved XAML files into FlowDocumentReader control in order to display them. It is described here.
I'm not only sure if flow documents can be embedded in resources. If it is not possible, I think that help files can be distributed separately. It doesn't seem to be a big problem.
Alternatively instead of flow documents you can use RTF format. RichTextBox can be also used to edit this kind of documents.

Selecting text and image from pdf through any programming language

I'm trying to develop a tool/web application such that it will import a PDF file and I need to select text and images available in PDF by selecting them with a mouse click and marking them as title,content and image with a button click (3 different button) where the marked contents and image will be copied to clipboard or will be pasted into a word document which is going to be a another part. So in which programming language is this possible to work with and carry on ?
I'd probably try researching pure browser-side solution using pdf.js and clipboard API.
Otherwise, you'd still need clipboard API in the browser and the server-side may actually be powered by any programming language which can be hooked into a web server and has a library to parse PDFs.
You said nothing at all about your prospective server platform but to name a few, .NET has PdfSharp which is able to read PDFs, Python has a host of tools available for it. After all, there exist a bunch of command-line utilities to extract data from PDF which can be called using any PL able to call external processes.
Note that this only appears to be a simpler solution than using pdf.js but note that unless your PDFs are really uniform (say, invoices created by some piece of software), and so you'll be able to make your PDF parser know which bits of data it has to extract and return, the parser will need to returl all the data it extracted to the client, and you'll need to somehow render it all there. May be it's exactly what you need but maybe not.
Since PDFs are really tailored for typesetting and not presenting information in a structured manner, I'd try to piggyback on an already hard-core PDF rendering solution which runs in the browser, so see above.

word processing with Visual Studio 2013

I'm new to office development and want to create a simple application that :
opens a word 2007-2010-2013 template.
reads each and every placeholder.
fills each one with the appropriate data.
However, how can I create a placeholder in a word template ?
How can I list placeholders and fill them using VB 2013 ?
Reading and writing word documents can be done in multiple ways. The easiest is probably from Inside Word itself. Microsoft provides a package called Visual Studio Tools for Office which can be used to integrate a plugin directly into word itself. You're probably looking for the Word Content Controls feature. And that could be used with XML data binding.
You can also host Word in your own application and then interact directly with the loaded document using the Office Primary Interop Assemblies. These managed classes are a wrapper around the COM objects that Office exposes. The XML data binding features are available through PIO as well. Look at the Word XML example which can be downloaded from this samples page. Primary interop assemblies are only supported in Interactive applications. Microsoft does not support running Office applications from a server/service application.
If you can limit yourself to the new XML Document standard you can extract the content from the document as XML and manipulate these directly (requires quite a bit of knowledge about the Word Document structure). The Packaging class structure provided by the .NET framework contains everything needed to extract the document parts, once extracted it's simple XML. Or you could use an open source wrapper around the XML document format, such as the open source DocX library. A template field could simply be a special text like {{TEMPLATE FIELD:FieldName}}.
There are also a number of commercial libraries available, some with built-in mail-merge features. I personally have good experience with Aspose.Words. Their documentation on Mailmerges can be found here.

How to convert Word and Excel documents to PDF programmatically?

We are developing a little application that given a directory with PDF files creates a unique PDF file containing all the PDF files in the directory. This is a simple task using iTextSharp. The problem appears if in the directory exist some files like Word documents, or Excel documents.
My question is, is there a way to convert word, excel documents into PDF programmatically? And even better, is this possible without having the office suite installed on the computer running the application?
Office 2007 allows for this. I have found PDFCreator to be good, the VBA is included in sample files, and have heard that CutePDF is also good. PDFCreator and CutePDF are free.
To work without Office, you would need viewers, as far as I know:
http://www.microsoft.com/downloads/details.aspx?FamilyID=c8378bf4-996c-4569-b547-75edbd03aaf0&displaylang=EN
http://www.microsoft.com/downloads/details.aspx?familyid=95E24C87-8732-48D5-8689-AB826E7B8FDF&displaylang=en
I needed to do this myself, but managed to get it done with .Net and without 3rd party tools:
MSDN: Saving Word 2007 Documents to PDF and XPS Formats
Pretty simple, about 50 lines of code. However I think you will need Word 2007 installed on the machine as well as the ability to Save As PDF
To convert Word documents to PDF, take a look at jWordConvert, a java library that can do exactly that. This will not work with the Excel files though, only with the Word files. The language is not Sharp, it's Java but you could switch to use IText (which is java) instead of ITextSharp.
You can also use a component like activePDF's DocConverter to convert a lot formats to PDF.
Use PDF maker that comes with adobe 7- 9
I just used this code Covert Doc to PDF
I'm surprised Aspose wasn't mentioned here, it's easy, simple, and reliable. Downside is that it is not free.
I've used iTextSharp in the past, it's really good, easy to install (one DLL I believe), the merge takes a bit of tindering so it's not as easy to use as Aspose, but hey, it's free so that is the best part.
TallPDF.NET (comes with a hefty price tag) allows you to serve dynamic PDF from any .NET application including ASP.NET pages and web services.
PDFEdit (free and open source) is an editor for manipulating PDF documents. It has a GUI version and a command-line interface. Scripting is used to a great extent in the editor and almost anything can be scripted. It is possible to create your own scripts or plugins.
The most common way to convert files to a pdf is to print them to a pdf printer driver. There are a number of such drivers, one that i know of that will do the job is Black Ice.
Another is to use Adobe Acrobat's SDK. from memory its very expensive.
Its been a while since i have actually done any work with converting pdf's and the landscape may have changed.