5 Replies Latest reply on Aug 17, 2011 9:29 AM by John Hawkinson

    datamerge crashes (indesign server)

    wait andrew

      I am trialing indesign server....

       

      I have successfully created a js based datamerge using the soap example

       

      I am now trying to do this programatically (e.g. directly interfacing with the server objects)

       

      In both C# and VB I am getting a crash everytime I execute the datamerge MergeRecords function.

       

      Below is the script I am running, with comments, if the doc.DataMergeProperties.MergeRecords("c:/temp/wibble.txt") line is commented out the script will execute fine, uncomment it and the whole thing crashes, including the server, when another function is called afterwards.

       

      This is driving me mad

       

      Any help appreciated ... if it is any help I have a c# visual studio 2010 project that isolates the issue and can be zipped and email/posted

       

       

       

      Option Explicit Off

       

      Partial Class vbcreate

          Inherits System.Web.UI.Page

       

          Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

      Response.Write("here")

       

      'Dim app As InDesignServer.Application

      'Dim doc As InDesignServer.Document

       

      app = CreateObject("IndesignServer.Application")

       

      doc = app.Open("C:/Adobe InDesign CS5.5 Server SDK/samples/sampleclient-aspnet-soap/files/template2.indd")

       

      '''''' Below returns 1 so OK up to here

      Response.Write(app.Documents.Count)

       

       

      ds = "C:/Adobe InDesign CS5.5 Server SDK/samples/sampleclient-aspnet-soap/files/CSV/xls.csv"

       

       

      app.dataMergeOptions.removeBlankLines = True

       

      doc.DataMergeProperties.SelectDataSource(ds)

       

      '''''' Below still returns 1 so still working

      Response.Write(app.Documents.Count)

       

      ''''' the wibble file is created but then the application CRASHES

      doc.DataMergeProperties.MergeRecords("c:/temp/wibble.txt")

       

       

      '''''''EITHER of these two next lines will cause a crash

      Response.Write(app.Documents.Count)

      'doc.close(InDesignServer.idSaveOptions.idNo)

       

       

      'Response.Write(app.Documents.Count)

       

       

       

       

       

      End Sub

      End Class

        • 1. Re: datamerge crashes (indesign server)
          John Hawkinson Level 5
          I have successfully created a js based datamerge using the soap example

          I am now trying to do this programatically (e.g. directly interfacing with the server objects)

          When you say "server objects" do you mean COM objects? Or do you mean InDesign DOM objects?

           

          Are you saying that the same script written in JavaScript works fine? Or was it behaving differently?

          If JS works, then you probably have some kind of typing problem, which may or may not be your own. Obviously anything that crashes InDesign is a bug. You suggest you're using CS5.5 -- are you using the 7.5.1 update?

           

          Anyhow, the obvious (but lame) workaround is to call out to Javascript.

          I would, however, get the JS and VB programs as close as possible to each other and start comparing them to see if you can find the source of the problem.

           

          I seem to recall some people regenerating the TLB and even patching it because of type problems...

          • 2. Re: datamerge crashes (indesign server)
            John Hawkinson Level 5

            Oh, BTW, this post would be better off in the scripting forum, I think; honestly I didn't notice it wasn't there.... Or the InDesign Server forum that nobody reads -- oh hey, you've posted there!

            Please be explicit about when you are posting the same question in two different places, and please link from one to the other. It makes it much easier to manage and reduces wasted effort.

            • 3. Re: datamerge crashes (indesign server)
              wait andrew Level 1

              Thanks for the reply!

               

              I cross posted deliberately as no one had even read the entry in the server forum, you'll see that it is days older, mea culpa for not including the relevant link/hightlighting the cross post.

               

              To answer your other questions

               

              I am refering to Indesign COM objects; as you'll see from the code excerpt I have instantiated an app object (app = CreateObject("IndesignServer.Application")) successfully added a template file (doc = app.Open("C:/Adobe InDesign CS5.5 Server SDK/samples/sampleclient-aspnet-soap/files/template2.indd")) assigned the data merge data source (doc.DataMergeProperties.SelectDataSource(ds)) but it then falls down when the actual datamerge is called.

               

              FYI, I have tried this in C#, vb.net and even classic ASP (vbscript) because of the typeing issues with c# and they all fall down at the same point.

               

              I have a JSX version of this; this works fine if I pass it Indesign Server using SOAP (I am using the bundled sample soap script at the moment which is in Adobe InDesign CS5.5 Server SDK\samples\sampleclient-aspnet-soap), the datamerge works and the files are created fine.

               

              I am using 7.5.1 (the trial was downloaded last week).

               

              I am currently using the "lame" approach (call out using JS and the process the directory containing the files after Indesign has finished); but as the processed files have then to be associated with database records this is driving me mad.

               

              Hope this expansion is helpful.

               

              Regards

               

              Andrew Wait

              • 4. Re: datamerge crashes (indesign server)
                John Hawkinson Level 5

                Well. I'm uncertain what to suggest. I have no idea what kind of presales support the ID Server team provides, but they're a low-volume product with high margins, so perhaps they will be able to go the extra mile.

                 

                I guess I would try hybridizing your code between VB and JS. You should be able to use the .toSpecifier() or .toSource() methods (at least in JS) to serialize your data references and pass them between VB and JS. That way you should be able to get a JS program that works fine except for one line that it calls to VB, which would be an excellent test case for the bug.

                 

                Alternatively, a VB program that calls the JS to do the guts of the work, but still has access to the resulting files so you can connect them up with your database records (that was a vit vague in your explanation).

                 

                But I really don't have any COM+ experience, so perhaps someone else will chime in. Maybe Peter, Bob, or Harbs can move this thread to the scripting forum to increase the chances of that. (A little inconvenient to recreate the whole thread there again...)

                • 5. Re: datamerge crashes (indesign server)
                  John Hawkinson Level 5

                  Oh, also: does it work in InDesign Desktop?