←选择平台

InsertPagesFrom方法

总结
从现有的PDF文件中插入一个或多个页面的文件与此相关PDFFile对象。
语法
c#
c++
Java
公共无效InsertPagesFrom (intinsertPageNumber,PDFFile源文件,intfirstPageNumber,intlastPageNumber)
vb (vb语法)公共子InsertPagesFrom (_按值传递_insertPageNumber_整数,_按值传递_sourceFile_作为PDFFile,_按值传递_firstPageNumber_整数,_按值传递_lastPageNumber_整数_)
公共无效insertPagesFrom (intinsertPageNumber,PDFFile源文件,intfirstPageNumber,intlastPageNumber);
公共:无效InsertPagesFrom (intinsertPageNumber,PDFFile ^源文件,intfirstPageNumber,intlastPageNumber)

参数

insertPageNumber
基于数量的插入点PDFFile对象。使用值0插入新页开始的文件和1在文件的末尾插入新页(附加)。

源文件
一个PDFFile对象与现有的PDF文件,包含源文件插入页面。

firstPageNumber
基于多源文件的第一页插入。必须是一个值大于或等于1。

lastPageNumber
基于多源文件的最后一页插入。必须是一个值大于或等于firstPageNumber和小于或等于该文件的总页数。使用的特殊价值1代表“文件最后一页”。

讲话

在这两个文件PDFFile(目的地)源文件必须存在,包含在调用这个方法之前有效的PDF文件。

使用这种方法,把这个PDFFile对象和源PDFFile使用有效的PDF文件和可选的密码。你可以通过使用来实现这一点PDFFile(字符串文件名)PDFFile(文件名字符串,字符串密码)构造函数或一组文件名和可选的密码直接进入文件名密码属性。你不需要打电话负载使用这种方法。

该方法将使用以下属性PDFFile对象:

  • DocumentProperties。如果此属性的值,则将使用默认的属性

  • SecurityOptions。如果该属性的值加密目标文件,那么将会使用这个属性的属性。如果此属性的值,结果文件将不会被加密

  • CompatibilityLevel。的版本生成的PDF文件

例子

这个例子将从现有的PDF文件中插入页面不同在不同的位置。

c#
使用Leadtools.WinForms;使用Leadtools;使用Leadtools.Codecs;使用Leadtools.Controls;使用Leadtools.Drawing;使用Leadtools.ImageProcessing;使用Leadtools.Pdf;使用Leadtools.Svg;公共无效PDFFileInsertPagesFromExample (){字符串originalFileName = Path.Combine (LEAD_VARS.ImagesDir,@“Leadtools.pdf”);字符串sourceFileName = Path.Combine (LEAD_VARS.ImagesDir,@“PDFSegmentation.pdf”);字符串destinationFileName1 = Path.Combine (LEAD_VARS.ImagesDir,@“InsertAtBeginning.pdf”);字符串destinationFileName2 = Path.Combine (LEAD_VARS.ImagesDir,@“InsertInMiddle.pdf”);字符串destinationFileName3 = Path.Combine (LEAD_VARS.ImagesDir,@“InsertAtEnd.pdf”);/ /原始文件的一个副本文件。复制(originalFileName destinationFileName1,真正的);文件。SetAttributes (destinationFileName1 FileAttributes.Normal);文件。复制(originalFileName destinationFileName2,真正的);文件。SetAttributes (destinationFileName2 FileAttributes.Normal);文件。复制(originalFileName destinationFileName3,真正的);文件。SetAttributes (destinationFileName3 FileAttributes.Normal);/ /这是源PDF文件插入到目的地PDFFile源文件=PDFFile (sourceFileName);/ /插入sourceFileName2 destinationFileName1初PDFFile文件=PDFFile (destinationFileName1);文件。InsertPagesFrom(0,源文件,1,1);/ /插入sourceFileName2 destinationFileName2在中间文件=PDFFile (destinationFileName2);file.InsertPagesFrom (file.GetPageCount() / 2,源文件,1,1);/ /插入sourceFileName2 destinationFileName3结束时(附加)文件=PDFFile (destinationFileName3);文件。InsertPagesFrom(1,源文件,1,1);}静态LEAD_VARS{公共常量字符串ImagesDir =@“C: \ LEADTOOLS22 \ Resources \图片”;}
需求

目标平台

另请参阅

参考

PDFFile类

PDFFile成员

Leadtools。Pdf组装
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2022领先的技术公司。保留所有权利。