How to use PDFbox dll in QTP vbscript - dll

I need to use PDFbox dll in QTP vbscript , initially I tried to convert PDFbox jar to respective PDFbox dll with help of ikvmbin-7.2.4630.5, it was successfully so that i can use pdfbox.dll in c# and VB.NET similarly i need to use it with vbscript - QTP . Initially tried to access the converted PDFbox.dll using DotNetFactory.CreateInstance
Set TestPDFDoc = DotNetFactory.CreateInstance("org.apache.pdfbox.pdmodel.PDDocument","D:\\PDF\\PDF\\pdfbox-1.7.1.dll")
while executing it throws me but it throws me
Type 'org.apache.pdfbox.pdmodel.PDDocument' not found in any loaded assembly
can anyone help me out
Thanks

I don't think you need to escape the backslashes, ie use \\ instead of just \ ? I don't know QTP, but in VBScript, you don't need to escape backslashes.
Ie try
Set TestPDFDoc = _
DotNetFactory.CreateInstance("org.apache.pdfbox.pdmodel.PDDocument", _
"D:\PDF\PDF\pdfbox-1.7.1.dll")

Most likely, the error occurs because one or more assemblies referenced by your .dll could not be found. Use a .NET dependency viewer tool (for example, the open-source ILSpy) to determine the referenced assemblies and place them to the same folder as pdfbox-1.7.1.dll. I guess you need to place some of the IKVM.NET assemblies next to your .dll.

Related

Why does intellisense fail on my F# script?

I've been building a library to interact with one of my databases at work and everything is working fine. But when I open a new script and begin to use the library, it always freaks out when I try to use query expressions on the database. They work when I send them to F# interactive but the intellisense fails, drawing red lines under everything. Why is this? I would like my own dll to be the only thing a user would need to reference for a script.
System.Data.Linq is a reference in my dll file and I've set its Copy Local property to True to no avail. Other than that I haven't the faintest clue of what could be wrong.
What you're showing in the screenshot is evidently an F# script (an .fsx file). Since the code that tries to access the table is in the script file, it is the script file that needs a reference to System.Data.Linq. The fact that your AIXSupport.dll library has the reference does not help: references do not "transfer" like that.
Simply add this one at the beginning of the script:
#r "System.Data.Linq"

Import Library with special character in IronPython

I got a C++.NET library from a colleague with a name like "my-name.dll". Importing in IronPython is not possible since "from my-name import *" is not valid.
If I rename the library to "myname.dll" I get an error that the assembly manifest is missing (HRESULT: 0x80131018). Now I'm not sure wether it is a problem of the wrong name of the accompanying "my-name.lib" file (renaming didn't help) or if there is something different wrong.
I'm not an expert in .NET but as I testet with a VB.NET dll which I built myself (with a proper name) alle worked well.
Any ideas?
It's probably an issue with the assembly; calling clr.AddReference('my-name.dll') should work just fine. One possibility is that your machine is missing the proper VC++ runtime files. Try creating a small VB/C# application and loading the DLL from there.
Also, make sure the assembly is not blocked.

Error when trying to zip files VB.NET 2003

I have to make a simple zip file using Visual Studio and VB.NET 2003.
After some googling I got to this page: http://www.digioz.com/tutorials/zip_unzip_vbNET/Zip_and_Unzip_VB_NET_1.html wich basically provides me 3 DLLs with classes that are ready to zip files.
When I try to create an instance of the class like the tutorial tells me to:
Dim zp As New CGZipLibrary.CGZipFiles
I get this error:
COM object with CLSID {293364BA-43F8-11D3-BC2D-4000000A2806} is either not valid or not registered.
Ideas?
If anybody got a better/easier approach to zip files using VB.NET 2003 it would be helpful too.
Thanks.
EDIT:
Thanks for all who answered, but I've used a different approach than the suggested ones to zip my files.
I used the Shell function of the Microsoft.VisualBasic.Interaction class like this:
Shell("zip -j " & fileName, AppWinStyle.Hide, True)
Thanks again for those who dedicated their time trying to help me!
It looks like that library you are trying to use is an old COM dll. That means you have to register the dll first using regsvr32.exe before you can use it. However, I would recommend using a native .NET (managed) library. Unless it doesn't meet your needs, I'd simply recommend looking at the GZipStream class which is part of the .NET framework.
Have you tried this one? This is pretty good: ionic.zip.reduced, a dotnetzip library.
Example:
Using zip As ZipFile = New ZipFile()
zip.AddFile("c:\photos\personal\7440-N49th.png")
zip.AddFile("c:\Desktop\2008_Annual_Report.pdf")
zip.AddFile("ReadMe.txt")
zip.Save("MyZipFile.zip")
End Using
More VB.NET examples of Ionic.ZIP
UPDATE:
Your problem is that VS2003 can't use the targeting of the dll which was created in a newer (eg. VS2005) version of VS. For many have tried to use that, a tool was created which you can download here. For more information, visit this site.
Another option that I use in most of my projects is #ZipLib (SharpZipLib), downloads available here:
http://www.icsharpcode.net/opensource/sharpziplib/Download.aspx
Documentation and samples for both VB and C# are available at the same site. It has specific binary assemblies (dll) for .NET framework 1.1, as well as later versions. It's likely that some of the other libraries that you're run across are compiled for .NET 2.0 or later, which won't work in VS2003.
Don't let the name fool you -- it's written in C# (hence the name) but the compiled assemblies work just fine in VB.NET. It supports Zip, GZip, tar, and BZip2 archives.

Is It possible to add dll refrence of c# file into Labwindow

Is It possible to add dll refrence of c# file into Labwindow.
Hi I want to use dotnet program written in c# in Labwindow/cvi in c language is it possible or not??
Your question poses other questions, but in a nutshell, Yes, you can use a .net/c# .dll within CVI. The easiest way is to include a header file and .lib generated for that .dll. The CVI project should compile/build and run.
yes it is possible
on help>Contents>index> dll you will find Exporting DLL Functions and Variables
there is 3 way to do so , but i suguest " Using the Export Qualifier Method "
best regards

If I use a Type Library (.tlb) in a VB6 project, do I need to distribute it with the .exe?

If I make use of a Type Library in a VB6 project do I need to distribute the .tlb file (and perhaps even register it?) with the compiled exe on the target computer?
No, usually it is only needed if you actually call code that attempts to use the types from the type library. I have found some exceptions, involving using types from the type library to dimension variables. I think it was something like this...
Supposing the type library defines a structure A, and your app contains a procedure like this. If the type library is not registered your app cannot start - an error message is displayed.
Sub testSub1(ByRef mybadarray() As A)
but this would be OK
Sub testSub2()
Dim ok As A ' OK provided you never actually Call testSub2 at runtime '
In my experience, I always distribute .TLB file along with .EXE including registration, it helped me to prevent the multiple run-time errors like "Run-time error '429': ActiveX component can't create object".
No you don't. It's only used at compile time.
Only if you are using multi-threading, i.e. ActiveX EXEs or in-proc with CoMarshalInterThreadInterfaceInStream etc. functions.