Hi - I have a simple project that manipulates Adobe Illustrator that works
fine at home on Windows XP Pro (with admin login), but gives me an error
(error message and source code below) at work with Windows Pro 2000 (user
login). I'm a novice, so I'm pulling my hair out trying to figure out why I
get "Member not found" still. What I've checked:
- Same version of Illustrator on both machines (v10)
- Same version of .NET on both machines (v1.1)
- Gave the assembly (both .exe and .dll) full rights with .NET Configuration
utility (at work)
- Made sure Interop.Illustr ator.dll is in same directory as app (as you can
see, the error message says it's loaded)
I don't think it's a security issue as the app does run, does load
Illustrator and does create a new document. But like I said, it works
perfectly fine at home.
Thanks for your help in advance!
Cliff
----------------------------------------------------------
ERROR MESSAGE AT WORK:
----------------------------------------------------------
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Runtime. InteropServices .COMException (0x80020003): Member not found.
at System.RuntimeT ype.ForwardCall ToInvokeMember( String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at Illustrator._Br ushes.RemoveAll ()
at PrintFinalPdf.F inal_PDF.PrintP df(String strPubChoice)
at PrintFinalPdf.F inal_PDF.Valida teInput()
at PrintFinalPdf.F inal_PDF.btnPri nt_Click(Object sender, EventArgs e)
at System.Windows. Forms.Control.O nClick(EventArg s e)
at System.Windows. Forms.Button.On Click(EventArgs e)
at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.288
CodeBase:
file:///c:/winnt/microsoft.net/framework/v1.0.3705/mscorlib.dll
----------------------------------------
PrintFinalPdf
Assembly Version: 1.0.1486.28950
Win32 Version: 1.0.1486.28950
CodeBase:
file:///C:/Documents%20and %20Settings/cliffb/Desktop/Trader%20Tools/PrintFin
alPdf.exe
----------------------------------------
System.Windows. Forms
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.288
CodeBase:
file:///c:/winnt/assembly/gac/system.windows. forms/1.0.3300.0__b77 a5c561934e
089/system.windows. forms.dll
----------------------------------------
System
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.288
CodeBase:
file:///c:/winnt/assembly/gac/system/1.0.3300.0__b77 a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.288
CodeBase:
file:///c:/winnt/assembly/gac/system.drawing/1.0.3300.0__b03 f5f7f11d50a3a/sy
stem.drawing.dl l
----------------------------------------
Microsoft.Visua lBasic
Assembly Version: 7.0.3300.0
Win32 Version: 7.00.9502
CodeBase:
file:///c:/winnt/assembly/gac/microsoft.visua lbasic/7.0.3300.0__b03 f5f7f11d5
0a3a/microsoft.visua lbasic.dll
----------------------------------------
Interop.Illustr ator
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:
file:///C:/Documents%20and %20Settings/cliffb/Desktop/Trader%20Tools/Interop.
Illustrator.DLL
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this application
or machine (machine.config ) must have the jitDebugging value set in the
system.windows. forms section. The application must also be compiled with
debugging enabled. For example: <configuratio n>
<system.windows .forms jitDebugging="t rue" /> </configuration> When JIT
debugging is enabled, any unhandled exception will be sent to the JIT
debugger registered on the machine rather than being handled by this dialog.
----------------------------------------------------------
SOURCE CODE (I omitted the Windows Form generated code):
----------------------------------------------------------
Public Class Final_PDF
Inherits System.Windows. Forms.Form
Private Sub btnPrint_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnPrint.Click
ValidateInput()
End Sub
Sub ValidateInput()
txtDtp.Focus()
If Not IsNumeric(txtDt p.Text) = True Then
MsgBox("Please enter a DTP number.", MsgBoxStyle.Exc lamation,
"Warning")
txtDtp.Focus()
txtDtp.SelectAl l()
ElseIf lbxPub.Selected Item = "-----------------------" Then
MsgBox("Please choose a publication.", MsgBoxStyle.Exc lamation,
"Warning")
Else
PrintPdf(lbxPub .SelectedItem.T oString)
End If
End Sub
Sub PrintPdf(ByVal strPubChoice As String)
'launch illustrator and create preferences
Dim appRef As New Illustrator.App lication()
Dim docRef As Illustrator.Doc ument
Dim rulerPrefs As Illustrator.AiR ulerUnits =
Illustrator.AiR ulerUnits.aiUni tsPoints
Dim alertPrefs As Illustrator.AiU serInteractionL evel
Dim colorPrefs As Illustrator.AiC olorModel
Dim savePrefs As Illustrator.AiS aveOptions
Dim printPrefs As Illustrator.AiP ostScriptLevel
rulerPrefs = Illustrator.AiR ulerUnits.aiUni tsPoints
colorPrefs = Illustrator.AiC olorModel.aiPro cess
alertPrefs = Illustrator.AiU serInteractionL evel.aiDontDisp layAlerts
savePrefs = Illustrator.AiS aveOptions.aiDo NotSaveChanges
'create new document
docRef = appRef.Document s.Add
'remove unused materials
docRef.Swatches .RemoveAll()
docRef.Symbols. RemoveAll()
docRef.Patterns .RemoveAll()
docRef.ArtStyle s.RemoveAll()
docRef.Brushes. RemoveAll()
'determine pdf path
Dim pdfPath As String
Dim pubChoice As String
Select Case strPubChoice
Case "REG GLOSS"
pdfPath = "\\work\path\1\ "
pubChoice = "pub1"
Case "REG GUTS"
pdfPath = "\\work\path\2\ "
pubChoice = "pub2"
Case "NHG GLOSS"
pdfPath = "\\work\path\3\ "
pubChoice = "pub3"
Case "NHG GUTS"
pdfPath = "\\work\path\4\ "
pubChoice = "pub4"
End Select
'create pdf info text
Dim pdfInfo As Illustrator.Tex tArtItem
pdfInfo = docRef.TextArtI tems.Add
pdfInfo.Content s = "FINAL PDF | DTP: " & txtDtp.Text & " |
PUBLICATION: " & pubChoice
pdfInfo.Left = 24
pdfInfo.Top = 768
'create date text
Dim dateText As Illustrator.Tex tArtItem
dateText = docRef.TextArtI tems.Add
dateText.Left = 465
dateText.Top = 768
dateText.Conten ts = Today().ToShort DateString & " | " &
Now().ToShortTi meString
'create placed dtp art
Dim pdfFullPath As String = pdfPath & txtDtp.Text & ".pdf"
Try
Me.Hide()
docRef.GroupIte ms.CreateFromFi le(pdfFullPath)
docRef.PrintOut () 'False was the option
'docRef.Close(s avePrefs)
Catch
MsgBox("The file " & pdfFullPath & " does not exist." & vbCrLf & "Make sure
the PDF was processed and the DTP is correct.", MsgBoxStyle.Exc lamation,
"Warning")
'docRef.Close(s avePrefs)
End Try
Me.Close()
End Sub
Private Sub btnExit_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnExit.Click
Me.Close()
End Sub
Private Sub mnuMainFileExit _Click(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles mnuMainFileExit .Click
Me.Close()
End Sub
Private Sub txtDtp_Enter(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles txtDtp.Enter
txtDtp.SelectAl l()
End Sub
End Class