Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hello all

I'm using the following code to print PDF using my network printer. But the problem is that I need to Install Adobe Reader 6 to achieve my task. Is there any workaround that I can print PDF's by having acrobat reader version 6.0 or more

Or any Perl modules which prints the PDF's with any version of Acrobat installed ....

use strict; use warnings; use Win32::OLE; use Win32::OLE::Const "Acrobat"; my $acrobat = Win32::OLE->new("AcroExch.App", "Quit"); my $avdoc = Win32::OLE->new("AcroExch.AVDoc"); my $pdfs = getPDF("/from/some/folder"); foreach my $pdf( @{$pdfs} ) { $avdoc->Open( $pdf, "" ); my $pddoc = Win32::OLE->new("AcroExch.PDDoc"); $pddoc->Open($pdf); my $pp = $pddoc->GetNumPages; #index starts at 0 my $totalpages = $pp; if ( $pp ) { $pp--; } eval { print "Printing $pdf with $totalpages pages\n"; $avdoc->PrintPagesSilent(0,$pp,1,1,0); }; if ( $@ ) { print "PDF did not print due to Adobe error.\n"; } $acrobat->Exit; }

Thanks to original author for giving me a pointer to help achieve my task

In reply to Print PDF using Win32::OLE and Acrobat Reader by kalyanrajsista

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (7)
    As of 2019-10-14 22:44 GMT
    Find Nodes?
      Voting Booth?