Parsing and Converting PostScript Files

Posted on 2004-08-02
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1200 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.
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.


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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

PaperPort 14.5 Patch 1 update is often not detected or downloaded automatically. This article provides direct download links to solve the problem for retail (non-bundled) versions of the Standard and Professional editions, as well as the Professiona…
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
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.
Microsoft Office Picture Manager has a Picture Shortcuts pane that shows a list with the Recently Browsed folders. While creating my video Micro Tutorial here at Experts Exchange showing How to Install Microsoft Office Picture Manager in Office 2013…

762 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