#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    80
    Rep Power
    12

    Script works in a Konsole / not as a cron job


    Hello,

    I'm running FreeBSD 6.2 with KDE 3.5.

    I wrote a small script that calls acroread to convert a PDF file to a PostScript file. The script works great if I run it in the a KDE Konsole, but if I try to set it up as a cron job I receive the following error.

    Code:
    (acroread:2040): Gtk-WARNING **: cannot open display:
    Does anyone know any way around this??

    Thanks in advance.
  2. #2
  3. No Profile Picture
    Needs a pillow.... :)
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2006
    Posts
    681
    Rep Power
    91
    Since you are running this as a cron you will need to setup a virtual frame buffer to run the acroread in. Unless you can tell acroread to run headless? Well looking at acroread there is no option for headless.

    So you can create a frame buffer by...
    Code:
    Xvfb :1 -screen 1 800x600x16 &
    So now you have a virtual frame buffer that you can push applications into it.

    Code:
           --screen=<SCREEN>
    
                  X screen to use. Use this options to override the screen part of
                  the DISPLAY environment variable.
    
    
    acroread -screen :1 [options]
    Let me know if this helps!
    A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. - Douglas Adams
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    80
    Rep Power
    12
    jtalerico,

    Thanks for the reply. Please forgive me if I sound like an idiot.

    If I issue this command at boot it will create the Virtual Frame Buffer, correct?
    Code:
    Xvfb :1 -screen 1 800x600x16 &

    When do I use this? And what is <SCREEN>
    Code:
    --screen=<SCREEN>
    The last part I understand. I'll edit my script using the following.
    Code:
    acroread -screen :1 [options]
    At this point it isn't working for me because I don't fully understand the code.

    Thanks for all of you're help.
  6. #4
  7. No Profile Picture
    Needs a pillow.... :)
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2006
    Posts
    681
    Rep Power
    91
    The SCREEN is the virtual frame buffer you created to push the application to.

    You need it here:

    acroread -screen :1 [options]
    A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. - Douglas Adams
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    80
    Rep Power
    12
    This is what I'm typing

    [mike@BSD62 ~]$ Xvfb :1 -screen 1 800x600x16 &

    [mike@BSD62 ~]$ acroread -screen :1 -toPostScript -scale -80 -shrink -optimizeForSpeed ./page1.pdf
    [mike@BSD62 ~]$ (acroread:801): Gtk-WARNING **: cannot open display:


    Is --screen=<SCREEN> a command? Where would it go?
    Thanks for your patience.
  10. #6
  11. No Profile Picture
    Needs a pillow.... :)
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2006
    Posts
    681
    Rep Power
    91
    I was just showing you what the man page of acroread shows for pushing it to a different screen.

    To see what i am talking about do a 'man acroread'. Maybe other versions differ?

    Sure thing, let me know if you are still having problems getting it started.

    Comments on this post

    • dfr574 agrees : Excellent advice.
    A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. - Douglas Adams
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    80
    Rep Power
    12
    Got it working!! Thanks for all of you help
    This is what worked.

    $ Xvfb :1 -screen 0 800x600x16 &
    $ export DISPLAY=BSD62.1

    acroread --screen=1 -toPostScript -scale -80 -shrink -optimizeForSpeed ./page1.pdf



    Thanks again!! I would have never figured it out without your help.
  14. #8
  15. No Profile Picture
    Needs a pillow.... :)
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2006
    Posts
    681
    Rep Power
    91
    Glad to see that bit helped!

    Looks to be a lot of people on the web trying to automate things with acroread. Maybe post a how-to with what you learned on here.
    A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. - Douglas Adams

IMN logo majestic logo threadwatch logo seochat tools logo