Results 1 to 7 of 7

Thread: Printing a PDF Document to a Network Printer using PERL or BASH

  1. #1

    Default Printing a PDF Document to a Network Printer using PERL or BASH

    I have a webform that sends data to a perl script that then creates a PDF document before sending it off by email to someone.

    I need to print out some of these PDF Documents. At the mo i'm finding, opening and then printing manually. Simple and straight forward process.

    However it would be great if it was printed automatically as required. One in four require printing and i occasionally forget causing problems later on!

    The perl script can establish which do and don't need printing.

    What would be the best way to achieve this?

    Add the Perl NET:: Printer module
    Add Bash code to print the document to the printer.

    Yast (openSUSE 15 Leap) fails to find the perl-net-printer module, how do i install this module?

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,302
    Blog Entries
    15

    Default Re: Printing a PDF Document to a Network Printer using PERL or BASH

    Quote Originally Posted by akwe-xavante View Post
    I have a webform that sends data to a perl script that then creates a PDF document before sending it off by email to someone.

    I need to print out some of these PDF Documents. At the mo i'm finding, opening and then printing manually. Simple and straight forward process.

    However it would be great if it was printed automatically as required. One in four require printing and i occasionally forget causing problems later on!

    The perl script can establish which do and don't need printing.

    What would be the best way to achieve this?

    Add the Perl NET:: Printer module
    Add Bash code to print the document to the printer.

    Yast (openSUSE 15 Leap) fails to find the perl-net-printer module, how do i install this module?
    Hi
    You would need to configure and use cpan on your system as there is no perl-net-printer available for Leap (and Tumbleweed it's in the CPAN staging repository, not in the release).
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3

    Default Re: Printing a PDF Document to a Network Printer using PERL or BASH

    Thank you so much,

    I think this is my best way forward.

    Thank you

  4. #4

    Default Re: Printing a PDF Document to a Network Printer using PERL or BASH

    I sucessfully installed the NET:: Printer module after resolving a few issues along the way and when i print a PDF document (from within a perl script) to the printer i just get a blank sheet of paper!!

    So i thought i would try the NET::CUPS:: Destination Module instead.....

    Stumped, the module attempts install and fails with a message saying cups/cups.h is missing.... #include <cups/cups.h>. The file is missing, compilation terminated.

    libcups2 is installed, i can't find cups.h anywhere on the system.

    I can open a PDF Document and print it to the HP Network Printer OK, it's a CP2025n at the IP address 10.1.1.25 port 9100.

    Where am i going wrong?

    Should i try removing libcups2 and then re-installing it? whereis libcups returns libcups:

    So it looks as though it's not installed.

  5. #5

    Default Re: Printing a PDF Document to a Network Printer using PERL or BASH

    Installed cups-devel and cups-filters and NET:: CUPS :: Destination seems to have installed ok.

    Just need to now work out how to print a PDF Document to the printer from within a perl script, something to have a go at tomorrow.

  6. #6
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,407

    Default Re: Printing a PDF Document to a Network Printer using PERL or BASH

    Take a look at this: <https://metacpan.org/pod/release/DML...-1.007/LPR.pod>.
    • Assuming that, the Line Printer daemon conforms to RFC 1179 …

    BTW, .PDF files are (mostly) text files …

  7. #7

    Default Re: Printing a PDF Document to a Network Printer using PERL or BASH

    Thank you to those that have responded.

    I have given up on getting cpan's NET:: Printer module to print files to a local network printer.

    I have however managed to get a PDF document sent to the printer and printed out from a perl script by invoking a shell command instead.

    Given that the webform and the perl script is UserName and PassWord protected on a secure web server and things are setup in a way that these specific files are only accessible from specific devices with static ip addresses on the local network only. They are not accessible via the WAN. I've decided this is a controlled and accepteable risk to take.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •