4 Replies Latest reply on Feb 9, 2015 10:18 AM by tomvandezande

    WriteDocument SVG not working when debugging

    tomvandezande Level 1

      Hi,

       

      I am trying to save a file as svg (silently in the background), by doing the following:

       

      ai::FilePath svgFile;

      err = sAIFilePath->NewFilePath(svgFile);

      err = sAIFilePath->Set(ai::UnicodeString("/Users/tom/tmp.svg"), true, svgFile);

      err = sAIDocument->WriteDocument(svgFile, kAISVGFileFormat, false);


      When running the plugin from Xcode (in debug mode) this isn't working. There are no errors but the svg file stays empty and untouched. If I try to manually "File" -> "Save as" ->  "SVG" -> "Save" it shows a dialog with a button "SVG Code...". If I click on it nothing happens! Is the svg feature broken somehow?


      Now for the weird part; if I just run Illustrator and use the plugin that way (not in debug mode), none of the above problems occur.

       

      I am totally stuck, any help is greatly appreciated.

       

      Best,
      Tom

        • 1. Re: WriteDocument SVG not working when debugging
          LeoTaro Level 4

          Re: Code doesn't work in debug mode.

          When is your code being called? If it is not called directly as a result of a message to your plugin main function, you might need to set the application context.

           

          Re: "SVG Code..." button doesn't do anything.

          This button should launch a browser window with the SVG code. Maybe Illustrator cannot find your browser?

          • 2. Re: WriteDocument SVG not working when debugging
            tomvandezande Level 1

            Leo, thanks for your reply.

             

            I am setting the app context like this:

            AppContext appContext(fPluginRef);


            That SVG code button usually opens the svg code in my text editor, but not in this case (when running in debug mode out of Xcode).


            Note that none of the above issues occur when running AI manually and running the plugin that way. I already checked the build/run scheme and it is the same AI application that is being run.


            Any other thoughts?


            • 3. Re: WriteDocument SVG not working when debugging
              tomvandezande Level 1

              This might be important info add:

               

              Adobe Illustrator CC SDK Build 18.7.0

              Xcode 6.1

              Adobe Illustrator 18.1.1

              • 4. Re: WriteDocument SVG not working when debugging
                tomvandezande Level 1

                I have isolated the problem somewhat. I think it is a bug, maybe someone can try to reproduce this?

                 

                1. Open one of the examples provided as part of Adobe Illustrator CC 2014 SDK (I used annotator).
                2. Make sure AI CC 2014 is loading the samples.
                  1. In AI CC 2014 preferences, go to "Plugins & Scratch Disks"
                  2. Check additional Plugins Folder
                  3. Choose the dir in which the sample project will be build: [...]SDK/samplecode/output/mac/debug
                3. In Xcode (6.1), Product -> Scheme -> Edit Scheme.
                4. Select Run (debug) and use the following settings:
                  1. build configuration: debug
                  2. executable: Adobe Illustrator CC 2014.app
                  3. check debug executable
                5. Product -> Run
                6. Now, Xcode will debug the sample in AI.
                  1. Create a new document
                  2. File -> Save as..
                  3. Choose SVG as the format and click save.
                  4. A Dialog will appear, keep the default settings and click Save.

                 

                In my case, this results in a dialog with the message: The operation cannot complete because of an unknown error. [PARM]

                 

                Note that the problem only occurs in AI CC 2014. In AI CC it works correctly.

                 

                Thanks,

                Tom