calling external program tiff2pdf

Discussion in 'Perl Misc' started by John, Jun 13, 2008.

  1. John

    John Guest

    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
     
    John, Jun 13, 2008
    #1
    1. Advertising

  2. John <> wrote:
    > Part of program


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


    > There is no conversion.


    I guess you shouldn't have a space between the '-o' and the
    '$newfile'.
    Regards, Jens
    --
    \ Jens Thoms Toerring ___
    \__________________________ http://toerring.de
     
    Jens Thoms Toerring, Jun 13, 2008
    #2
    1. Advertising

  3. John

    John Guest

    "Jens Thoms Toerring" <> wrote in message
    news:-berlin.de...
    > John <> wrote:
    >> Part of program

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

    >
    >> There is no conversion.

    >
    > I guess you shouldn't have a space between the '-o' and the
    > '$newfile'.
    > Regards, Jens
    > --
    > \ Jens Thoms Toerring ___
    > \__________________________ http://toerring.de


    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
     
    John, Jun 13, 2008
    #3
  4. John

    John Guest

    "John" <> wrote in message
    news:g2td8d$bs7$...
    > 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
     
    John, Jun 13, 2008
    #4
  5. "John" <> wrote in
    news:g2tvd1$epa$:

    > 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 <>
    (remove .invalid and reverse each component for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://www.rehabitation.com/clpmisc/
     
    A. Sinan Unur, Jun 13, 2008
    #5
  6. John

    John Guest

    "A. Sinan Unur" <> wrote in message
    news:Xns9ABCB90643395asu1cornelledu@127.0.0.1...
    > "John" <> wrote in
    > news:g2tvd1$epa$:
    >
    >> 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 <>
    > (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
     
    John, Jun 14, 2008
    #6
  7. John

    Dr.Ruud Guest

    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?

    --
    Affijn, Ruud

    "Gewoon is een tijger."
     
    Dr.Ruud, Jun 14, 2008
    #7
  8. John

    John Guest

    "Dr.Ruud" <> wrote in message
    news:...
    > 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?
    >
    > --
    > Affijn, Ruud
    >
    > "Gewoon is een tijger."
    >


    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.
     
    John, Jun 14, 2008
    #8
  9. John

    szr Guest

    John wrote:
    > "Jens Thoms Toerring" <> wrote in message
    > news:-berlin.de...
    >> John <> wrote:
    >>> Part of program

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

    >>
    >>> There is no conversion.

    >>
    >> I guess you shouldn't have a space between the '-o' and the
    >> '$newfile'.
    >> Regards, Jens
    >> --
    >> \ Jens Thoms Toerring ___
    >> \__________________________ http://toerring.de

    >
    > 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.

    --
    szr
     
    szr, Jun 15, 2008
    #9
  10. John

    szr Guest

    A. Sinan Unur wrote:
    > "John" <> wrote in
    > news:g2tvd1$epa$:
    >
    >> 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.


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

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


    > perldoc -f system


    --
    szr
     
    szr, Jun 15, 2008
    #10
  11. John

    John Guest

    "szr" <> wrote in message
    news:...
    > John wrote:
    >> "Jens Thoms Toerring" <> wrote in message
    >> news:-berlin.de...
    >>> John <> wrote:
    >>>> Part of program
    >>>
    >>>> my $filename="fred.tiff";
    >>>> my $newfile="john.pdf";
    >>>> system ("tiff2pdf -o $newfile $filename");
    >>>
    >>>> There is no conversion.
    >>>
    >>> I guess you shouldn't have a space between the '-o' and the
    >>> '$newfile'.
    >>> Regards, Jens
    >>> --
    >>> \ Jens Thoms Toerring ___
    >>> \__________________________ http://toerring.de

    >>
    >> 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.
    >
    > --
    > szr
    >

    Hi

    I had already chmod and I could r/w.
    Many thanks for input
    Regards
    John
     
    John, Jun 16, 2008
    #11
  12. John

    James muffin Guest

    > 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.
     
    James muffin, Jun 19, 2008
    #12
  13. John

    Bill H Guest

    On Jun 19, 4:27 pm, James muffin <> wrote:
    > > 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.


    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
     
    Bill H, Jun 20, 2008
    #13
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Slaughter

    Calling external program in C++

    Jon Slaughter, Dec 13, 2004, in forum: C++
    Replies:
    9
    Views:
    25,828
  2. Juggler

    calling external program from within C++

    Juggler, Feb 24, 2005, in forum: C Programming
    Replies:
    5
    Views:
    581
    Nils Weller
    Feb 24, 2005
  3. Jeff
    Replies:
    13
    Views:
    1,146
    vanilla
    Oct 6, 2007
  4. Emmanouil Angelakis

    Calling external program from within python

    Emmanouil Angelakis, Jul 25, 2008, in forum: Python
    Replies:
    10
    Views:
    574
    Terry Reedy
    Jul 25, 2008
  5. Eric
    Replies:
    3
    Views:
    636
Loading...

Share This Page