From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.net Frameworks in LabVIEW

Solved!
Go to solution

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.

0 Kudos
Message 1 of 14
(3,718 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 14
(3,713 Views)

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!

Tom L.
Message 3 of 14
(3,710 Views)

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.

0 Kudos
Message 4 of 14
(3,709 Views)

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.

0 Kudos
Message 5 of 14
(3,704 Views)

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 🙂

0 Kudos
Message 6 of 14
(3,697 Views)

If you have questions, feel free to ask.

0 Kudos
Message 7 of 14
(3,692 Views)

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.

0 Kudos
Message 8 of 14
(3,681 Views)

Perhaps, explain the much detail as possible what you want to do.

0 Kudos
Message 9 of 14
(3,665 Views)

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.

0 Kudos
Message 10 of 14
(3,649 Views)