m***@infinito.it
2011-01-31 15:32:03 UTC
Hi all,
I need to setup a simple routine in VBA/Access (2003 or 2007), which opens
an already existing PDF, writes a text extra line with some simple
formatting at a specificed position (in Word I would use a text box) with
data taken from an underlying Access query, and then opens Adobe Reader for
further actions by the user.
I thought to use iTextSharp to modify PDF, but I had problems at the very
beginning.
Since it is a .NET library, I registered iTextSharp.dll with: RegAsm
iTextSharp.dll /tlb:iTextSharp.tlb /codebase. Regasm I used is from .NET
Framework 4(4.0.30319.1), and my OS is Win7/64 on AMD. I got approx a dozen
warning for generic types. Then I opened Access 2007 and set the reference
to iTextSharp.tlb.
Then just in order to see everything was ok, i tried:
Private Sub PDFButton_Click()
Dim pdfTemplate As String
pdfTemplate = "C:TmpD0001.PDF"
Dim TestClass As pdfReader
Set TestClass = pdfReader(pdfTemplate)
The rest was not developed because the execution always stops at the last
row with the error: Function or Sub not defined.
I realized, by opening the Object window in VB, that any class included by
iTextSharp has no member at all.
Therefore my question is:
1) Was I wrong by choosing the initial procedure (to make iTextSharp usable
by VBA/Access)?
2) If I was not wrong, is it that the assembly registration was essentially
not successful? If true, why?
I am wondering if this could be due to the generic types signalled by
regasm. In this case the reason would be inside the code, as far as I can
see. Is there a way to let iTextSharp correctly expose its classes to COM
environment?
Thanks for any help, which will be greatly appreciated.
Marco B.
I need to setup a simple routine in VBA/Access (2003 or 2007), which opens
an already existing PDF, writes a text extra line with some simple
formatting at a specificed position (in Word I would use a text box) with
data taken from an underlying Access query, and then opens Adobe Reader for
further actions by the user.
I thought to use iTextSharp to modify PDF, but I had problems at the very
beginning.
Since it is a .NET library, I registered iTextSharp.dll with: RegAsm
iTextSharp.dll /tlb:iTextSharp.tlb /codebase. Regasm I used is from .NET
Framework 4(4.0.30319.1), and my OS is Win7/64 on AMD. I got approx a dozen
warning for generic types. Then I opened Access 2007 and set the reference
to iTextSharp.tlb.
Then just in order to see everything was ok, i tried:
Private Sub PDFButton_Click()
Dim pdfTemplate As String
pdfTemplate = "C:TmpD0001.PDF"
Dim TestClass As pdfReader
Set TestClass = pdfReader(pdfTemplate)
The rest was not developed because the execution always stops at the last
row with the error: Function or Sub not defined.
I realized, by opening the Object window in VB, that any class included by
iTextSharp has no member at all.
Therefore my question is:
1) Was I wrong by choosing the initial procedure (to make iTextSharp usable
by VBA/Access)?
2) If I was not wrong, is it that the assembly registration was essentially
not successful? If true, why?
I am wondering if this could be due to the generic types signalled by
regasm. In this case the reason would be inside the code, as far as I can
see. Is there a way to let iTextSharp correctly expose its classes to COM
environment?
Thanks for any help, which will be greatly appreciated.
Marco B.