calling external program tiff2pdf

J

John

Hi

Part of program

my $filename="fred.tiff";
my $newfile="john.pdf";
system ("tiff2pdf -o $newfile $filename");

There is no conversion.

I've tried "./tiff2pdf" also.

Any ideas?
John
 
J

John

Jens Thoms Toerring said:
I guess you shouldn't have a space between the '-o' and the
'$newfile'.
Regards, Jens

Hi

Tried that but it didn't work.
It is strange since it works on the linux command line when I key in
tiff2pdf -o john.pdf fred.tiff
Odd.

John
 
J

John

John said:
Hi

Part of program

my $filename="fred.tiff";
my $newfile="john.pdf";
system ("tiff2pdf -o $newfile $filename");

There is no conversion.

I've tried "./tiff2pdf" also.

Any ideas?
John


Hi, all

Manage to crack it. You need to place all parameters in quotes including
the -o.

system ("tiff2pdf","-o","$newfile","$filename")

Many thanks
John
 
A

A. Sinan Unur

Manage to crack it. You need to place all parameters in quotes
including the -o.

system ("tiff2pdf","-o","$newfile","$filename")

Nope, you misunderstand what you did here. The quotation marks above are
not important. What is important is the fact that you passed system a LIST
rather than a single string which by-passed the shell. I am assuming the
actual $newfile and $filename contained some characters that were
problematic for the shell.

perldoc -f system

Read the documentation for the functions you use.

Sinan

--
A. Sinan Unur <[email protected]>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
 
J

John

A. Sinan Unur said:
Nope, you misunderstand what you did here. The quotation marks above are
not important. What is important is the fact that you passed system a LIST
rather than a single string which by-passed the shell. I am assuming the
actual $newfile and $filename contained some characters that were
problematic for the shell.

perldoc -f system

Read the documentation for the functions you use.

Sinan

--
A. Sinan Unur <[email protected]>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/

Hi

I always read the documentation whenever I have a problem with a particular
construct. Well, at least my Perl nutshell.
$newfile and $filename only contained fred.tiff and john.pdf.
What system is expecting is an array.
Thanks for input.

Regards
John
 
D

Dr.Ruud

John schreef:
my $filename="fred.tiff";
my $newfile="john.pdf";
system ("tiff2pdf -o $newfile $filename");

There is no conversion.

I've tried "./tiff2pdf" also.

Then the problem is in the part that you didn't show, or you didn't
copy/past the part literally.

If you for example used single quotes in the real version, that would
explain it.

What did Dan's code show you?
 
J

John

Dr.Ruud said:
John schreef:


Then the problem is in the part that you didn't show, or you didn't
copy/past the part literally.

If you for example used single quotes in the real version, that would
explain it.

What did Dan's code show you?

Hi

I cut and pasted. The solution is you need to give a list as I mentioned
earlier.
Many thanks for your input.
Regards
John

You make great Gazelle bicycles.
 
S

szr

John said:
Hi

Tried that but it didn't work.
It is strange since it works on the linux command line when I key in
tiff2pdf -o john.pdf fred.tiff
Odd.

Then it might be a permissions problem then. Make sure the script has rw
access to the dir the pdf will be written in.
 
S

szr

A. Sinan Unur said:
Nope, you misunderstand what you did here. The quotation marks above
are not important. What is important is the fact that you passed
system a LIST rather than a single string which by-passed the shell.
I am assuming the actual $newfile and $filename contained some
characters that were problematic for the shell.

Also, $newfile and $filename don't need double quotes around them. Just
pass them straight:

system ('tiff2pdf', '-o', $newfile, $filename);
 
J

John

szr said:
Then it might be a permissions problem then. Make sure the script has rw
access to the dir the pdf will be written in.
Hi

I had already chmod and I could r/w.
Many thanks for input
Regards
John
 
J

James muffin

Hi
I cut and pasted. The solution is you need to give a list as I
mentioned earlier.

Its not though, I've never done that(given a list), and using the code
you posted it works for me. Something else is up...

I used this as the full program:

my $filename="fred.tiff";
my $newfile="john.pdf";
system ("tiff2pdf -o $newfile $filename");

worked just fine.
 
B

Bill H

Its not though, I've never done that(given a list), and using the code
you posted it works for me. Something else is up...

I used this as the full program:

my $filename="fred.tiff";
my $newfile="john.pdf";
system ("tiff2pdf -o $newfile $filename");

worked just fine.

I had a similar issue with system and imagemagik. From the command
prompt the command and the passed parameters worked great, from
system() it never worked. I finally figured out for some reason I have
to give the full path to imagemagik in the system() command for it to
work. Not sure if this will work for you but did for me.

Bill H
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top