Converting .ps file to .pdf file from where it is broken


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Converting .ps file to .pdf file from where it is broken
# 1  
Old 04-07-2008
Converting .ps file to .pdf file from where it is broken

In my folder Testing I have 5 files.

1.ps
2.ps
3.ps
4.ps
5.ps


Now When I am converting this .ps file to .pdf file then it is broken at the 2.ps file.

And I created one status.txt file where this broken file 2.ps is stored.

Now How shell I start to convert .ps file to .pdf file from 2.ps to 5.ps??????
Can anybody tell me the logic pleaseeeee.

It is very very urgent.

Thanks
# 2  
Old 04-07-2008
Can anybody help me in this??????

It is very urgent. Please reply ASAP.
# 3  
Old 04-07-2008
You really haven't given enough information for anyone to help you.
What is the script/command you are using to create the pdfs?
What output did you get when the process failed?
# 4  
Old 04-07-2008
Ok guys,
My input script is test.sh and the inputs of this test.sh file are

for i in /tmp/A380_RFS24/amm_r0_ps/*
do
if [ -f $i ]
then
#if the file is there
ps_file=${i#/tmp/A380_RFS24/amm_r0_ps/}
echo "filename is $ps_file"
cat status.txt | while read filename
do
echo "here $filename"
case "$filename" in
*ps)
PSDIR="/tmp/A380_RFS24/amm_r0_ps"
cd $PSDIR
echo "DIR is: $PSDIR"
echo "DIR is: $PSDIR" >> /tmp/A380_RFS24/log/A380_RFS24.log
echo "package is: $filename"
echo "package is: $filename" >> /tmp/A380_RFS24/log/A380_RFS24.log
if [ "$filename" == "$ps_file" ]
then
echo "running $filename"
echo "post script file name is: $ps_file"
ps_file1=`echo $ps_file| sed "s/.ps//g"`
echo "after deleting .ps extension package is: $ps_file1" >> /tmp/A380_RFS24/log/A380_RFS24.log
ps2pdf -dSAFER -sPAPERSIZE=a4 /tmp/A380_RFS24/amm_r0_ps/$ps_file1.ps /tmp/A380_RFS24/amm_r0_pdf/$ps_file1.pdf >> /tmp/A380_RFS24/log/A380_RFS24.log
echo "Successfully converted $ps_file1.ps to $ps_file1.pdf"
ps_file2=`echo $filename| sed "s/.ps//g"`
echo "after deleting .ps extension package is: $ps_file2" >> /tmp/A380_RFS24/log/A380_RFS24.log
ps2pdf -dSAFER -sPAPERSIZE=a4 /tmp/A380_RFS24/amm_r0_ps/$ps_file2.ps /tmp/A380_RFS24/amm_r0_pdf/$ps_file2.pdf >> /tmp/A380_RFS24/log/A380_RFS24.log
echo "Successfully converted $ps_file2.ps to $ps_file2.pdf"
staus_gscript=$?
echo "status after converting .ps to .pdf is: $staus_gscript" >> /tmp/A380_RFS24/log/A380_RFS24.log
if [ $staus_gscript -ne 0 ]
then
break
fi
fi
;;
esac
done
fi
done


Now in my status.txt file contains
package5.ps

Now when i am running the above test.sh script i am getting the following output.
> test.sh
filename is package1.ps
here package5.ps
DIR is: /tmp/A380_RFS24/amm_r0_ps
package is: package5.ps
filename is package2.ps
here package5.ps
DIR is: /tmp/A380_RFS24/amm_r0_ps
package is: package5.ps
filename is package3.ps
here package5.ps
DIR is: /tmp/A380_RFS24/amm_r0_ps
package is: package5.ps
filename is package4.ps
here package5.ps
DIR is: /tmp/A380_RFS24/amm_r0_ps
package is: package5.ps
filename is package5.ps
here package5.ps
DIR is: /tmp/A380_RFS24/amm_r0_ps
package is: package5.ps
running package5.ps
post script file name is: package5.ps
Successfully converted package5.ps to package5.pdf
Successfully converted package5.ps to package5.pdf
filename is package6.ps
here package5.ps
DIR is: /tmp/A380_RFS24/amm_r0_ps
package is: package5.ps
filename is package7.ps
here package5.ps
DIR is: /tmp/A380_RFS24/amm_r0_ps
package is: package5.ps


Now i want that after successfully converted package5.ps to package5.pdf it should convert the package6.ps and package7.ps means all the .ps file after the package5.ps

But it should not convert the package4.ps,package3.ps,package2.ps,package1.ps mens before the package5.ps.

i think now this much information is sufficient for you.

Can you please help me now..

I am really need the help ASAP..
# 5  
Old 04-07-2008
Code:
cd /path/to/ps_files
for i in 1 2 3 4 5 6 7 
do
     ps2pdf  -dSAFER -sPAPERSIZE=a4  'package'$i".ps" 'package'$i".pdf"
done

# 6  
Old 04-07-2008
Or even

Code:
for f in /path/to/ps_files/*.ps; do
  test -e ${f%.ps}.pdf || continue
  ps2pdf -dSAFER -sPAPERSIZE=a4 $f ${f%.ps}.pdf
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting secured pdf files to pdf using acroread

Does anybody have idea of Converting secured pdf files to pdf using acroread ? ---------- Post updated at 04:49 PM ---------- Previous update was at 04:44 PM ---------- This file is not password protected. (4 Replies)
Discussion started by: Soham
4 Replies

2. UNIX for Dummies Questions & Answers

Converting pdf to jpg in multiple directories?

Hi! On my Ubuntu I have thousands of files in a couple hundred directories. I'm trying to convert the pdf's to jpg's. I used this command in terminal: for fname in *.pdf; do convert $fname ${fname%.pdf}.jpg; doneIt works great but the problem is I have to run this in terminal for each... (2 Replies)
Discussion started by: martinsmith
2 Replies

3. UNIX for Dummies Questions & Answers

Ghostscript error while converting PDF to Postscript

Hi, I have been using Ghostscript to convert PDF to Postscript (PS) file. GS version : 8.15.2. GS command used is : gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pswrite -sOutputFile=output1.ps input1.pdf File format conversion to PS is success in majority of the cases but some PDF files are... (0 Replies)
Discussion started by: geeveejey
0 Replies

4. Shell Programming and Scripting

Script for converting a pdf to book format

Hello, excuse my English... I'm trying to do a nautilus-script to transform a normal A4 pdf to another pdf with book format, ready to be printed (double sided). I mean, the script put pages in order and also put 2 pages per horizontal A4 page (p.e.: a pdf with 8 pages would look like: 8-1, 2-7,... (2 Replies)
Discussion started by: dokan
2 Replies

5. Shell Programming and Scripting

Converting html to pdf perl

Hi All, I have a requirement of converting an html form into pdf using perl. The html form contains images, tables and css implementation. I tried using various perl modules but failed to achive the target. I succeeded in generating a pdf from the html file using... (2 Replies)
Discussion started by: DILEEP410
2 Replies

6. UNIX for Dummies Questions & Answers

Converting LATEX PDF to WORD document

Hi there, is it possible to convert pdf files to Word with some free :p software or with some trick??? Now I'm working with LATEX and I can get pdf format but I would like to get .rtf or .doc files too:rolleyes:. Lately I found something like that, but it wasn't free. Thanks for any... (1 Reply)
Discussion started by: Giordano Bruno
1 Replies

7. UNIX for Dummies Questions & Answers

Converting multiple latex files to pdf

Hi everybody! This is my first post. I am a student and I'm familiarizing myself with linux. I have lots of directories each containing file called "zadaci.latex". I want to convert them to pdf's and rename them to <directory_name>.pdf. I read alot on this forum and came up with this script:... (2 Replies)
Discussion started by: Element9
2 Replies

8. AIX

AIX converting PDF to PS

my app creates pdf and prints them on windows. I want to run the same app on AIX 5.2. I convert PDF to PS using acroread command. But some options of acroread like landscape etc do not work. I came to know from google that there is bug with acroread for AIX with landscape option. Can you suggest... (3 Replies)
Discussion started by: vinayakshukre
3 Replies

9. Shell Programming and Scripting

Converting ps file to pdf

I have a number of post script files (*.ps) which I need to convert into Pdf. I am using the ps2pdf command for this, but the trouble is that this commands takes only one input at a time. So the command ps2pdf *.ps doesnt work. how can I make a script which will take each .ps file from... (3 Replies)
Discussion started by: jasjot31
3 Replies

10. UNIX for Advanced & Expert Users

converting PDF to text, rtf doc format

Hi all Is there any program which can convert PDF to word processor file ? If the PDF has smart quotes, bullet icons, copyright and trademark symbols, etc. what happens to them intext format? So ideally would like to conver into rtf or doc. Thanks SS (1 Reply)
Discussion started by: saurya_s
1 Replies
Login or Register to Ask a Question