OLE打印PDF(Perl)

跟ABAP没有什么关系。只是可以说明OLE提供了转PDF的处理方式。

Printing PDF files using Win32::OLE and Acrobat Exchange

Posted by Domenico Discepola on July 15, 2004, 3:56 pm
Hello.  My goal is to print Adobe PDF files from a Perl script without any
user intervention.  I have been experimenting with various methods and am
now trying to use Win32::OLE to control Adobe Acrobat Exchange (v5.0.5).
Please refer to the code below.  I can create the acrobat object, open the
document and retrieve some information from the document.  My problems are:

1. Although I make acrobat visible using the show method, only the
application becomes visible, not the document.  How do I fix this?

2. What is the method to print the document once it has been opened?  The
"PrintPagesEx" method produces an error "Win32::OLE 0.1701) error
0x80020003: "Member not found" in METHOD/PROPERTYGET "" at jps2.pl line 30".
I then tried to loop through the hash referenced by the $doc variable but no
output from the hash was printed.

3. As an aside, if someone can provide me with the class name for Acrobat
Reader (not Acrobat exchange, as I have coded below) that would be great (or
inform me how to find it).  I am relatively inexperienced in the world of
OLE Automation so any hints would be helpful.


##############
#!perl
use strict;
use warnings;
use diagnostics;
use Win32::OLE;
use Win32::OLE::Const "Acrobat";
our $g_file_input = shift @ARGV;
die "Usage: $0 filenamen" unless $g_file_input;

sub process_main {


 #This does not work



}

sub main {
 print "PDF programn";
 &process_main();
 print "Ending nown";
}

&main();
exit 0;
###############

Posted by Matt Garrish on July 15, 2004, 8:43 pm


(or


4.1 Differences Among the Acrobat Viewers

Acrobat supports all of the OLE automation methods
listed in this chapter.

The Acrobat Reader does not support OLE automation.


For more info: http://partners.adobe.com/asn/acrobat/docs/iacovr.pdf

(And I don't have Exchange, so I can't help you with the rest.)

Matt

 

--------

 

Success!  Here is the code that opens up and prints a PDF using Win32::OLE
and Acrobat Exchange (v5.0.5 is the version I have).  Thanks for the link to
Acrobat Exchange's OLE Objects and Methods.  Too bad that Acrobat Reader
doesn't support OLE automation - I'm sure more people could have benefited
from this.

######################
#!perl
use strict;
use warnings;
use diagnostics;
use Win32::OLE;
use Win32::OLE::Const "Acrobat";
our $g_file_input = shift @ARGV;
die "Usage: $0 filenamen" unless $g_file_input;

sub process_main {

 }
 print "Num pages: $ppn";

}

sub main {
 print "PDF programn";
 &process_main();
 print "Ending nown";
}

&main();
exit 0;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: PB9是一种OLE文件格式,用于将PDF文件嵌入到其他应用程序中。OLE是对象链接和嵌入(Object Linking and Embedding)的缩写,是一种微软开发的技术,用于在不同应用程序之间共享和处理数据。 通过将PDF文件嵌入到应用程序中,我们可以在应用程序中直接打开和查看PDF文件,而无需打开独立的PDF阅读器。这样可以提高操作的效率和便利性。 PB9是指PowerBuilder 9,是一种用于构建企业级应用程序的集成开发环境。PB9提供了对OLE技术的支持,使开发人员能够在应用程序中嵌入PDF文件。 使用PB9的OLE功能,开发人员可以在应用程序中创建一个OLE对象来表示PDF文件,然后将其嵌入到应用程序的界面中。用户可以通过单击或其他操作来激活嵌入的PDF文件,并在应用程序中进行浏览和交互。 PB9的OLE功能还允许开发人员对嵌入的PDF文件进行编辑和处理。例如,可以通过调用PDF编辑器的接口来修改PDF文件的内容、添加注释或进行其他操作。 总之,PB9的OLE功能使得在PowerBuilder应用程序中嵌入和处理PDF文件变得更加简单和方便,提升了应用程序的功能和用户体验。 ### 回答2: PB9是由Adobe开发的一种文件格式,它的全称是Portable Document Format,简称PDFPDF是一种用于保存和传输文档的文件格式,它的设计目标是保持文档的跨平台性和可移植性。使用PDF格式,用户可以在不同的操作系统和设备上浏览和打印文档,而不会出现格式错误或内容丢失的问题。 PB9 Ole PDF则是指使用Adobe Acrobat Pro软件进行编辑和操作PDF文件的过程。Adobe Acrobat Pro是一款功能强大的PDF编辑软件,它可以让用户对PDF文件进行各种操作,如编辑文本、插入图片、调整页面布局、添加注释和书签等。在使用PB9 Ole PDF时,用户可以打开PDF文件并对其进行编辑,然后保存修改后的文件。 PB9 Ole PDF的应用非常广泛。例如,许多企业和机构使用PDF格式来保存重要的文档和报告,并使用Adobe Acrobat Pro对这些文件进行编辑和修订。此外,学生和教育工作者也可以使用PB9 Ole PDF来创建课件和教材,方便分享和传播。另外,许多电子书也使用PDF格式,用户可以将其下载到电脑、平板或手机上进行阅读。 总而言之,PB9 Ole PDF是指使用Adobe Acrobat Pro软件对PDF文件进行编辑和操作的过程。PDF作为一种通用的文档格式,被广泛应用于各个领域,帮助用户方便地保存、浏览和共享文件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值