Parsing and Converting PostScript Files

Posted on 2004-08-02
Last Modified: 2013-12-02
Hello Everyone !!

My question is more of a science of computing and programming in C++ rather then direct implication of programming and would love to hear an oppinion of any of you experts.

My task is to create a Program that will read and look for the key words within the postscript file, then convert that post script file into pdf and place the converted file onto the correct location on the network. Seems easy and I am sure that it might be.

My Question are
1. Does C or C++ have already built in command lines to do so??
2. Since I am aware that Unix / Linux uses the ps2pdf or similar bash scripts I am not sure if Windows has the same or similar?
3. I am also looking for the portability of the application that I need to build, so if I develop this in unix/linux env. this should also be portable on Windows, so what libs in C/C++ I culd use to built GUI to acheave that.

I guess proabably the discusion of this could go forver but these are basic outlines. I highly appreaciate everyones time and input on this question so I will award the 300 points for any great solutions. This question is not urgent (based on the points).

Question by:ledeni
  • 4
  • 3
LVL 13

Expert Comment

ID: 11693923
1) For every distribution of ghostscript there is normally a script/BAT file ps2pdf. You could use them to see what parameters are needed for calling ghostscript directly.
2) See 1)
3) Do you need a GUI or would a command line do? Latter is directly portable. For others you need to use something a lib Qt or use Borlands BuilderX.

Author Comment

ID: 11693994

1.) Is it possible to parse ps through the C / C++ (I know that ps is text based encoding of the file)
2.) does ps2pdf comes with ghostscript for windows ??
3) SteH I would rather prefer a minigfull GUI that would let user / basic IT stuff not to think much of the how to but rather run me to (wink wink) :). So I think that I would go with basic QT. But if  I would go with QT how easly distributed is accross the platforms of Unix / windows ??

Ledeni !!

LVL 13

Accepted Solution

SteH earned 300 total points
ID: 11694140
1) You can open the file as normal text file and read the content into a string. Depending on your needs this might be line by line or coomplete. Next you do a search for the keys your are looking for.
2) It comes with ghostscript not with ghostview. For windows those are normally 2 seperate packages. For gs 8.0 it is in the lib folder and it is there since some major revisions of GS.
3)I have not yet used Qt but it should be documented what support files are needed for distributing the application.
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.


Author Comment

ID: 11694171
Just one more question, if I was also to create that using the multhi threading processing how would ps2pdf behave on that way if the multiple command lines would be sent to the same bach file . Is the memory allocated for it automaticaly.

LVL 13

Expert Comment

ID: 11694226
I am not sure if multithreading would help you here. If you call an external program using ie spawn () or exec () you create another process which is already more seperated than a thread. You can just spawn several external processes which all get their own memory allocated.

Author Comment

ID: 11694269
I rather thinking of thr_create for threads rather then multi process (used with exec). I am thinking of this tho' that I will have at least 100 files to convert so instead of using multiprocesing to uset the multithreading to cut the unecessary process time of the main program to thread the rest of the files.

So if I got with threads instead process (with exec) would I need to allocate the memory for the bach file it self ??

LVL 13

Expert Comment

ID: 11694317
How do you want to execute the batch file within your thread? At least under win you spawn an external command line which runs the batch file. This should hold true for a unix/linux script as well. So additional processes are created anyhow why bother with additional thread in addition? The only reason to use one!! additional thread is to wait for the 100 processes to finished without hogging the GUI.

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a previous article published here at Experts Exchange, Signature Image with Transparent Background (, I explained how to cre…
This article provides the solution to a question ( posed here at Experts Exchange. The asker of the question has many JPG images in many folders, and all of t…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now