6 Replies Latest reply on Mar 5, 2012 1:14 PM by atulrungta

    Eps C++ parser

    atulrungta

      Hi all,

       

       

      I am not sure if this question belongs here, but I guess this forum should be the most appropriate. I am working with eps (encapsulated postscript) files and was looking for a C++ parser which could parse such files. I tried looking on the web but couldn't find anything of help. Actually, what I want is a way to compare 2 eps files to figure out the objects that have been added or deleted. Is there a way to do so?

       

       

      Thanks,

      Atul

        • 1. Re: Eps C++ parser
          Level 7

          GhostScript is the only complete EPS parser you'll find easily -- because PostScript is a complete programming language.

          If you're just looking at files generated by certain applications (like Illustrator), then you can look for the tokens it uses for objects/colors.

          • 2. Re: Eps C++ parser
            atulrungta Level 1

            Hi Chris,

             

            Thanks for the reply. Ghostscript seems like a viable option . About the latter half of my problem, let me explain in detail. Let's say we generate a plot using some application (MATLAB for example) which consists of dots and lines and save it as an eps. We then import this plot into a software like Illustrator or Canvas to beautify the plot. The problem arises when the original plot (the one generated in MATLAB) changes for some reason. That in turn would mean repeating the entire steps again (Doing the same beautification to the plot in Illustrator or Canvas all over again). Is there a way by which I can know what new objects were added to the eps so that I can beautify only those keeping others intact? And all this needs to be programatic

             

            Hope I was clear!

             

            Best,

            Atul

            • 3. Re: Eps C++ parser
              Level 7

              Hmm, not easily, since Illustrator or Canvas can change the output (it's not like merging a text file).

               

              My suggestion would be using layers in Illustrator to put the additions above the imported artwork.

              Or place the imported Matlab document and replace the contents as needed. (with the additions above it)

              • 4. Re: Eps C++ parser
                atulrungta Level 1

                Thanks again for the reply.

                My suggestion would be using layers in Illustrator to put the additions above the imported artwork.

                How can I get these "additions" since the plot is regenerated  ? That is my main concern right now, Can I use Ghostscript to compare the 2 eps' and get the difference between them?

                 

                Thanks,

                Atul

                • 5. Re: Eps C++ parser
                  Level 7

                  Then you add things above the matlab document without modifying the matlab document (by placing it and replacing the contents).

                   

                  If you are removing things, or changing the contents of the matlab document, then it is more complicated.

                  Then you'd need some way to parse the file contents - and GhostScript is the closest tool I can think of (but you'll have to modify the code).

                   

                  Unless you're processing thousands of these files, you might be making it more complicated than it needs to be.

                  • 6. Re: Eps C++ parser
                    atulrungta Level 1

                    Thanks! I'll look at Ghostscript and see it what it can do for me

                     

                    Best,

                    Atul