Howdy bros. I'm trying to write a script that will open a pdf document and save it as a text file. Apparently, the Acrobat API has no method for "save as" (WTF!).
So I'm wondering if there is some way to use OLE to click the appropriate item on the menu. In other words is there something I can do in the indicated spot here:
use strict;
use Win32::OLE;
use Win32::OLE::Const "Acrobat";
my $acrobat = Win32::OLE->new("AcroExch.App", "Quit");
my $avdoc = Win32::OLE->new("AcroExch.AVDoc");
$avdoc->Open( "foo.pdf" );
# Open and operate the Save As... dialog?
$avdoc->Close();
TIA...Steve
UPDATE
Alas, the solution offered below by angiehope, while it works, produces a print image of the page. That is not the same as what you get with Save As on the Acrobat menu, which isolates the text of the document from metadata, sidebar content, etc., and represents paragraphs a distinct strings. So if anyone has an idea how to solve this, I could still use it.
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, details, 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, summary, 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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.