Problem when call PS to Text SDK from C# source code

I have a simple text file that I printed which then converts the files into Postscript. I did this from Texpad, Wordpad, and from IExplorer. While converting the Postscript from Textpad, and Wordpad -11 is returned from ps2txtsdk and the file is not converted. When I print the same file from Internet Explorer it ps2txtsd returns 11, the the file is converted.

I have included these files for your review. Please let me know why this happens. We are trying to deploy an app for our clients where they can print anything to our (pseudo) printer and it will print to a postscript file, then we convert it to text using your SDK and transfer it to an FTP site. We have no control over what application they are going to use and we need to address a fix for this.

Customer

-----------------------------------------------------------

Return 11 is indicate conversion successful, please refer to the return codes at below,
//~~~~~~~~~~~~~~~~~~~
//0: - Success not found any problem.
//1: - Couldn't open PDF file, this PDF file maybe contains an open password or be damaged
//2: - Couldn't open output text file
//10: - Success with found some embed fonts.
//11: - Success with have only embed fonts in PDF file.
//12: - Fail with empty text file such as this PDF is picture scan or PDF have only picture.
//-1: - Fail with other causes (can not convert to text file) such as found exception, time out, not enough memory.
//-11: - Fail with something is wrong in input parameters,
//~~~~~~~~~~~~~~~~~~~

VeryDOC

-----------------------------------------------------------

That doesn't help at all. We printed a small text file using different applications. We used textoad, wordpad and iexplorer. We used only 2 arguments to the app and that was the ps file to convert and the text file to put the results in. I have already sent a zip file with the original text as well as the ps files created by the above applications I mentioned. The ps files produced by all of the applications look good. Your converter does not convert 2 of these files.

Giving me return values doesn't help. I already know I get -11 on two conversions and 11 on one. I don't understand how your reply is going to help.

I need your app to covert all the ps files especially when the original file is purely text.

Customer

-----------------------------------------------------------

Our PS2TXT SDK does convert your PS files to text files without any problem, please look at converted text files in attachment, these text files are all converted by PS2TXT SDK product. Can you get these text files in your system?

VeryDOC

-----------------------------------------------------------

Thanks. It did work.

For your information:

The difference between my application now and before is simply the declaration in C# for the external

The declaration was
[DllImport("ps2txtsdk.dll", EntryPoint = "VeryPDF_PSToText")]
private static extern Int32 VeryPDF_PSToText(string strcmd);

At this point some files would convert but others would not.

The declaration now is
[DllImport("ps2txtsdk.dll")]
internal static extern int VeryPDF_PSToText(string strcmd);

It converts all the test files. I don’t understand why the small declaration difference would cause this. I will do more extensive testing, and if I have a problem I will get back to you.

It would be helpful if you had some documentation that was sent out along with the SDK.

[DllImport("ps2txtsdk.dll")]
internal static extern int VeryPDF_PSToText(string strcmd);

static void Main(string[] args)
{
string sourcePath = Environment.CurrentDirectory;
string[] files = System.IO.Directory.GetFiles(sourcePath, "*.ps", SearchOption.TopDirectoryOnly);

// convert all files from *.ps to *.txt.
foreach (string ps in files)
{
var psFileName = System.IO.Path.GetFileNameWithoutExtension(ps);
var txt = sourcePath + @"\" + psFileName + ".txt";
string strCmd = "ps2txt -$ XXXXXXXXXXXXXXX " + ps + " " + txt;
long nRet = VeryPDF_PSToText(strCmd);
Console.WriteLine("Conversion Result: " + nRet.ToString());
}
}

-----------------------------------------------------------

private static extern Int32 VeryPDF_PSToText(string strcmd);
internal static extern int VeryPDF_PSToText(string strcmd);

The difference is int32 and int two data types,
-----------------------
Int16 is a short integer,
Int32 is a normal integer, in general, int is equal to int32 on 32bit system, however, on 64bit system, int is 64bit length, int32 is still 32bit length,
Int 64 is a double,

Capacities as follows

Int 16 -- (-32768 to +32787)
Int 32 -- (-2,147,483684 to +2,147,483683)
Int 64 -- (-9223372036854775808 to +9223372036854775807)

decide which one you need to use depending on the circumstances
-----------------------

Please look at following web pages for more information,

http://blog.risingperfection.com/2011/04/c-difference-between-int-and-int32.html
http://stackoverflow.com/questions/62503/c-int-or-int32-should-i-care

You can double check the length of int and int32 in your system carefully.

VeryDOC

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!