2 Replies Latest reply on Feb 13, 2015 8:16 AM by bastieneichenberger

    packageForPrint handle Exception

    bastieneichenberger Level 1

      Hi all, I have somes troubles to use the packageForPrint function. Util now I haden't any problems but I discover that: - If the document content an missing plug-in, you cannot make a package. - If you do that from hands you see the dialog "InDesign cannot make a package because a plug-in is missing" -> OK - But If you use a script the function doc.packageForPrint(…) return true! So how to catch the exceptions from the function packageForPrint? In advance, thanks you! Bastien Eichenberger

        • 1. Re: packageForPrint handle Exception
          Laubender Adobe Community Professional & MVP

          @Bastien – do you mean you can actually package an InDesign file by scripting wheras in the UI this is not possible because of the dialog?
          Or do you get "true" and no package is created? I think, this it what you want to know: How to test, if the package is made.

           

          I think you could test after packaging the InDesign File and see, if the value for File.exists is true…
          Or am I totally wrong here?

           

          Uwe

          • 2. Re: packageForPrint handle Exception
            bastieneichenberger Level 1

            Hi, Thanks you for the response. No you aren't wrong

            I did an example!

             

            // I would make something like this, it could be better to inform the user that the problem come from the extern modul
            
            try {
            
                var result_package = document.packageForPrint(current_folder, true, true, false, true, false, true, false);
            } catch (ex) {
               alert(ex.message) // no exception is send but the package isn't correct …
            }
            
            // I do this, it's not bad but you cannot inform the user. You just can say something wong :(
            var result_package = document.packageForPrint(current_folder, true, true, false, true, false, true, false);
            if(!File(current_folder + '/' document.name + '.indd').exist) {
               throw new Error('bad document');
            }