Question

I'm having a little problem with Photoshop CS4 automation. When I want to add a reference to the COM API in my Visual Studio 2008 project, the Adobe Photoshop Object Library doesn't show up in the "Add References" panel under the "COM" tab. However, the Illustrator CS4 Type library show up just fine. Photoshop itself run perfectly, both in the 32 and 64 bit flavor. Photoshop was installed along with every other app of the Master Suite CS4.

This didn't work on both Windows 7 and Windows XP, on 2 different machine + 1 virtual PC (Vmware workstation). I also tried it in the VS2010 Beta 1 and the MS Word VB editor, but it didn't work here either.

Anybody has any thought? If you were able to add a reference, what was your configuration?

Was it helpful?

Solution

There is no need to create a Virtual Machine, there is a problem with some versions of Photoshop in as much the COM does not show, to correct this run Photoshop as Administrator (just the once) and this will correct the registry entries and the COM will then be available.

OTHER TIPS

In the end, the solution was to use a Windows XP Virtual Machine with a standalone installation of Photoshop (instead of the whole creative suite). You can use it to generate a dll that work on any Windows with any installation of Photoshop CS4 (standalone or the creative suite).

EDIT : Here is the whole process

Create a Windows XP virtual Machine with your favorite virtualisation solution (Vmware, VirtualBox, VirtualPC etc). Install Visual Studio 2008 and a standalone installation of Photoshop CS4 (The whole creative suits haven't worked in my case, but your mileage may vary). Open Visual Studio and create either a new VB.NET or C# class library. Once this is done, right click on the "reference" folder in the solution explorer, and select add reference. Go to the COM tab, and search for "Adobe Photoshop CS4 type library". This will add two new references : "Photoshop" and "PhotoshopTypeLibrary". Create a dummy function (altough it may not be required) and build your project. As a good mesure, you can make sure that the compile mode is set to "release" but this is not required, debug will work fine. Once your project is builded, go to your project folder on your VM hard drive and look for the bin\release folder. There you will see 3 dll : one named after your project, one named Photoshop.dll and another namde Interop.Photoshop.dll. Copy the two last on your developpement machine with Windows 7 x64. You can then import them in your project by adding a references and browsing to those 2 dll.

A very sweet thing I noticed was that altough the dll were compiled on a 32 bit VM, they would still call the 64 bit version of Photoshop if your .NET program runned in 64 bit mode.

I hope it help!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top