Dear pdf experts,

I have an issue opening a pdf-file in java on windows the straight way. I do it this way Runtime.getRuntime().exec( "cmd /c start acrord32 " \"" + fileName + "\""); //fileName e.g. test.pdf

Adobe reader opens but with a message dialog (I translated with original german message into this english): "acrobat could not open "test.pdf", because the file type is not supported or the file is damaged (e.g. if it is sent as email attachement and ws not decoded correctly."

After touching with my java exec the pdf-file cannot be opened via windows directly any more. When I open the document it has another decoding now (many black rectangles with some strange other characters, the lines are pretty short now).

First I tried
Runtime.getRuntime().exec( "cmd /c " \"" + fileName + "\""); //fileName e.g. test.pdf without any success. Then I saw the solution inside the great iText library I pasted below. So if you use it it should work, but in my application it does not.

My windows 2000 5.00.2195 service pack 4.
I use Java 1.5.0_03.

Any hint would be warmly appreciated.

Thank you very much.

Best regards
Michael


Executable.java (tools package)

       private static Process action(final String fileName,
String parameters, boolean waitForTermination) throws IOException {
               Process process = null;
               String commandline;
               if (parameters.trim().length() > 0) {
                       parameters = " " + parameters.trim();
               }
               else {
                       parameters = "";
               }
               if (acroread != null) {
                       process = Runtime.getRuntime().exec(
acroread + parameters + " \"" + fileName + "\"");
               }
               else if (isWindows()) {
                       if (isWindows9X()) {
                               process = Runtime.getRuntime().exec(
"command.com /C start acrord32" + parameters + " \"" + fileName + "\"");

                       }
                       else {
                               process = Runtime.getRuntime().exec(
* "cmd /c start acrord32" + parameters + " \"" + fileName + "\""); *
                       }


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to