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.
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.


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 Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article discusses the PaperPort 14 Scanner Connection Tool, which Nuance provides at no charge in order to fix scanning problems in Windows 8. Furthermore, users of PaperPort 14 in Windows 7 and Windows 10 have reported that the tool works in t…
I. Introduction In a previous article ( (now deprecated), I discussed how to upgrad…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Microsoft Office Picture Manager is not included in Office 2013. This comes as quite a surprise to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This video expla…

707 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

12 Experts available now in Live!

Get 1:1 Help Now