Is there any Perl script to get the pages from a PDF file and convert the same to another PDF file?
是否有任何Perl脚本从PDF文件中获取页面并将其转换为另一个PDF文件?
7 个解决方案
#1
You asked for Perl, so here's a good solution via CAM::PDF. Say you just want pages 3-6 of orig.pdf to be saved to new.pdf:
你问过Perl,所以这是一个很好的解决方案,通过CAM :: PDF。假设您只想将orig.pdf的第3-6页保存到new.pdf:
deletepdfpage.pl orig.pdf 1-2,7- new.pdf
#3
As gnud already answered, pdftk is the best tool for the job. For example, to extract pages 5-10 from test.pdf to out.pdf you would write:
正如gnud已经回答的那样,pdftk是这项工作的最佳工具。例如,要将第5-10页从test.pdf提取到out.pdf,您可以编写:
pdftk test.pdf cat 5-10 output out.pdf
#4
On OS X you can just do this in Preview, by dragging pages in the thumbnail view.
在OS X上,您可以在预览中执行此操作,方法是在缩略图视图中拖动页面。
#5
The code given by Andreas didn't work for me. If using Pdftk, on Windows this formula worked for me :
安德烈亚斯给出的代码对我不起作用。如果使用Pdftk,在Windows上这个公式对我有用:
pdftk source.pdf cat 123-128 output out.pdf dont_ask
Source being obviously the source pdf, 123-128 the intervall of pages to extract and out.pdf the new pdf.
来源显然是源pdf,123-128提取页面的intervall和out.pdf新的pdf。
#6
I believe in actual code...This code may be useful for you :
我相信实际的代码...这段代码可能对您有用:
use CAM::PDF;
my $file_name="abc.pdf";
my $pdf = CAM::PDF ->new($file_name); my $no_pages=$pdf->numPages();
my $ pdf = CAM :: PDF - > new($ file_name); my $ no_pages = $ pdf-> numPages();
for(my $i=1;$igetPageText($i); print "$page\n"; # may u can read it an array/etc...manipulation can be done here }
for(my $ i = 1; $ igetPageText($ i); print“$ page \ n”;#可能你可以把它读成数组/等等......操作可以在这里完成}
#7
Interactively, there is the full version of Acrobat. Programatically there is the Acrobat SDK from Adobe and lots of 3rd party solutions. Google Acrobat API.
交互式地,有完整版的Acrobat。以编程方式提供Adobe的Acrobat SDK和许多第三方解决方案。 Google Acrobat API。
#1
You asked for Perl, so here's a good solution via CAM::PDF. Say you just want pages 3-6 of orig.pdf to be saved to new.pdf:
你问过Perl,所以这是一个很好的解决方案,通过CAM :: PDF。假设您只想将orig.pdf的第3-6页保存到new.pdf:
deletepdfpage.pl orig.pdf 1-2,7- new.pdf
#2
~$ pdftk multi-page.pdf burst
#3
As gnud already answered, pdftk is the best tool for the job. For example, to extract pages 5-10 from test.pdf to out.pdf you would write:
正如gnud已经回答的那样,pdftk是这项工作的最佳工具。例如,要将第5-10页从test.pdf提取到out.pdf,您可以编写:
pdftk test.pdf cat 5-10 output out.pdf
#4
On OS X you can just do this in Preview, by dragging pages in the thumbnail view.
在OS X上,您可以在预览中执行此操作,方法是在缩略图视图中拖动页面。
#5
The code given by Andreas didn't work for me. If using Pdftk, on Windows this formula worked for me :
安德烈亚斯给出的代码对我不起作用。如果使用Pdftk,在Windows上这个公式对我有用:
pdftk source.pdf cat 123-128 output out.pdf dont_ask
Source being obviously the source pdf, 123-128 the intervall of pages to extract and out.pdf the new pdf.
来源显然是源pdf,123-128提取页面的intervall和out.pdf新的pdf。
#6
I believe in actual code...This code may be useful for you :
我相信实际的代码...这段代码可能对您有用:
use CAM::PDF;
my $file_name="abc.pdf";
my $pdf = CAM::PDF ->new($file_name); my $no_pages=$pdf->numPages();
my $ pdf = CAM :: PDF - > new($ file_name); my $ no_pages = $ pdf-> numPages();
for(my $i=1;$igetPageText($i); print "$page\n"; # may u can read it an array/etc...manipulation can be done here }
for(my $ i = 1; $ igetPageText($ i); print“$ page \ n”;#可能你可以把它读成数组/等等......操作可以在这里完成}
#7
Interactively, there is the full version of Acrobat. Programatically there is the Acrobat SDK from Adobe and lots of 3rd party solutions. Google Acrobat API.
交互式地,有完整版的Acrobat。以编程方式提供Adobe的Acrobat SDK和许多第三方解决方案。 Google Acrobat API。