Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article provides the solution to a question (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28674207.html) posed here at Experts Exchange. The asker of the question has many JPG images in many folders, and all of t…
In a previous article here at Experts Exchange (http://www.experts-exchange.com/articles/18414/Create-a-PDF-file-with-Contact-Sheets-montage-of-thumbnails-for-all-JPG-files-in-a-folder-and-each-of-its-subfolders-using-an-automated-batch-method.html)…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

618 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