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
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 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.
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.


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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

In a previously published article ( here at Experts Exchange, I explained how to achieve duplex (double-sided) scanning in Nuance's PaperPor…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
In an interesting question ( here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

688 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