11-01-2013 02:45 PM
I find myself needing to edit .pdf files in LabVIEW (automatically fill in forms), which requires the use of the iTextSharp.dll - which happens to be a .net framework. To do JUST this seems fairly simple using the .dll, but unfortunately I have never worked with this before in any language, let alone LabVIEW. As I am going through, calling functions etc I am having a hard time keeping track of what exactly is going on (references aren't data as I'm used to dealing with it, using output.streams, etc etc.)
My question is: does anyone know of any good writeups or introductions to this in general? Hopefully with LV specific discussions. I have spent awhile searching online, but most of what I have found assumes a higher level of knowledge than I seem to have.
Solved! Go to Solution.
11-01-2013 02:59 PM
If you can find some information in e.g. C#, it's rather easy to translate, but in general you use a .net contructor and then a series of property nodes and invoke nodes.
/Y
11-01-2013 03:04 PM
Hello Aalenox,
This looks to be a good place to get started:
NI Community: Calling .NET Assemblies from LabVIEW
https://decibel.ni.com/content/docs/DOC-9138
There are quite a few LabVIEW-specific examples linked there, and the material is arranged in a pretty logical fashion. Hope that helps!
11-01-2013 03:05 PM - edited 11-01-2013 03:07 PM
I've figured out how to get it in, call up property and invoke nodes, pass data around etc. What I'm having a hard time with is figuring out when to use property node vs invoke node, how to access some of the other .net functions that seem simple in other languages (java's io.FileOutputStream for example) and things like that. I do have some examples to work from in other languages (VB, java and some C#), but transfering these to LV seems to be ... problematic.
For example: The sample java code for example says it returns a string. Invoke node of (I think) the same function in LV returns a reference. Trying to change this reference to a string gives either nonsense or the reference name.
Edit: Thanks for the link. I am not sure how I didn't stumble across it in searching, but it looks like it will help.
11-01-2013 03:07 PM - edited 11-01-2013 03:12 PM
Look at the link after my name. It is with iTextSharp 4.1.6. This will give you some ideas how to deal with iTextSharp and LabVIEW.
11-01-2013 03:11 PM
I have actually downloaded, installed, and gone through part of that libray. It is one of the reasons I was looking for some more general information on .net frameworks as I wasn't knowledgable enough to quite follow what was going on in a lot of those functions and calls. It will hopefully help me quite a bit later 🙂
11-01-2013 03:14 PM
If you have questions, feel free to ask.
11-01-2013 03:25 PM
Well since you are offering... the point I threw up my hands and decided research .NET framweorks was specifically when I tried replicating one of the simple examples on the http://itextpdf.com/examples page. The iTextSharp is not a small library, and I quickly found myself trying to find stuff, having no idea when to use property vs invoke node, or even how to call some of the functions that are in the .dll
For example: opening a constructor node for the AeroFields (iTextSharp.text.pdf) won't even open. I can make a reference to it, feed it in to either a property or invoke node and have access to some of the functions - but with no ability to feed it any data.
I guess just a rough idea of when to use what (constructor, invoke, property etc) and simple layouts to navigate through the framework and actually pull out useful information would be enough. I realize I'm asking for very vague information, because I don't even know enough yet to ask for something specific.
11-01-2013 04:52 PM
Perhaps, explain the much detail as possible what you want to do.
11-01-2013 06:09 PM - edited 11-01-2013 06:24 PM
Sorry for the delayed response - I had to step away from the computer for awhile. Basically, all that needs to happen is load a .pdf, find what forms are available, populate those forms with data from the program, and resave the .pdf.
It looks like the functions I need to call from the .dll are:
PdfReader (open pdf from string path)
AcroFields (get and set the open fields)
PdfStamper (actually change the fields)
and PdfWriter
It also appears I need a system output stream. Everything I have learned so far makes this seem like it will be fairly simple once I learn enough.
Edit: To make it simpler, the only type of field I will have to deal with is a text field. No radio buttons or anything.