Problem with using Photoshop DCOM in asp.net webservice.

SD
Posted By
Sam_Deepak
Apr 15, 2008
Views
370
Replies
1
Status
Closed
Hi ,

I am very new to this forum. I want quick resolution for my problem as I am in an urgency.

The scenerio is this:

I have a requirement in my project(c#.net 2.0) to convert EPS images to JPEG images. For this, I decided to use photoshop through DCOM. I was having VB samples from Adobe. Since it is needed in c#, I wrote a console based application for convertin an EPS image to JPEG image as referring to the VB code sample just to make it work in c#. But what happened is that eventhough the same VB code I wrote in c#, VB sample converts to JPEG images. The c# code could not even first EPS image. It says that after creating the action descriptor stuffs for opening an EPS file "Could not "Could not open the file Some path\some file.eps because of a program error". I am very much confused and surprised about how the same code in VB works and the code in c# gives this error. I compared both the codes, they look to be same. I am struck with this. Could anybody please help me?

The C# code is given below for your analysis:

C# code:
——–

FileInfo[] epsFilesList = new FileInfo[] { new FileInfo(@"C:\Inetpub\wwwroot\EPSConverter\EPSConverter\cover.eps ") };

PhotoshopApplicationClass appPS = new PhotoshopApplicationClass(); appPS.Visible = 0;

IActionDescriptor epsDescriptor = appPS.MakeDescriptor(); IActionDescriptor epsOptions = appPS.MakeDescriptor();

IActionDescriptor jpegDescriptor = appPS.MakeDescriptor(); IActionDescriptor jpegOptions = appPS.MakeDescriptor();

IActionControl action = appPS.MakeControlObject();

epsDescriptor.PutPath((int)__MIDL___MIDL_itf_OLEActions_0000 _0001.phKeyPath, epsFilesList[0].FullName);

epsOptions.PutUnitDouble((int)__MIDL___MIDL_itf_OLEActions_0 000_0001.phKeyWidth, (int)__MIDL___MIDL_itf_OLEActions_0000_0001.phUnitPercent, double.Parse("100"));
epsOptions.PutBoolean((int)__MIDL___MIDL_itf_OLEActions_0000 _0001.phKeyConstrainProportions, 1); epsOptions.PutUnitDouble((int)__MIDL___MIDL_itf_OLEActions_0 000_0001.phKeyResolution, (int)__MIDL___MIDL_itf_OLEActions_0000_0001.phUnitPercent, double.Parse("100"));
epsOptions.PutEnumerated((int)__MIDL___MIDL_itf_OLEActions_0 000_0001.phKeyMode, (int)__MIDL___MIDL_itf_OLEActions_0000_0001.phTypeColorSpace , (int)__MIDL___MIDL_itf_OLEActions_0000_0001.phEnumRGB);
epsOptions.PutBoolean((int)__MIDL___MIDL_itf_OLEActions_0000 _0001.phKeyAntiAlias, 1);

epsDescriptor.PutObject((int)__MIDL___MIDL_itf_OLEActions_00 00_0001.phKeyAs, (int)__MIDL___MIDL_itf_OLEActions_0000_0001.phClassEPSGeneri cFormat, epsOptions);

IActionDescriptor result = action.Play((int)__MIDL___MIDL_itf_OLEActions_0000_0001.phEv entOpen, epsDescriptor, (int)__MIDL___MIDL_itf_OLEActions_0000_0001.phDialogDontDisp lay);

//action.Play((int)__MIDL___MIDL_itf_OLEActions_0000_0001.ph EventFlattenImage, null, (int)__MIDL___MIDL_itf_OLEActions_0000_0001.phDialogSilent);

if (result == null)
{
Console.WriteLine("No result");
}
else
{
int hasKey = 0;
result.HasKey((int)__MIDL___MIDL_itf_OLEActions_0000_0001.ph KeyMessage, out hasKey); if (hasKey != 0)
{
string str = string.Empty;
result.GetString((int)__MIDL___MIDL_itf_OLEActions_0000_0001 .phKeyMessage, out str); }
}

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

DM
dave_milbut
Apr 15, 2008
hi sam, you’ll get better results in the scripting sub-forum-

<http://www.adobeforums.com/webx?13@@.ef7f2cb>

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

Related Discussion Topics

Nice and short text about related topics in discussion sections