Leadtools.Pdf Namespace > PDFFile Class : Convert Method |
public void Convert( int firstPageNumber, int lastPageNumber, string destinationFileName )
'Declaration Public Sub Convert( _ ByVal firstPageNumber As Integer, _ ByVal lastPageNumber As Integer, _ ByVal destinationFileName As String _ )
'Usage Dim instance As PDFFile Dim firstPageNumber As Integer Dim lastPageNumber As Integer Dim destinationFileName As String instance.Convert(firstPageNumber, lastPageNumber, destinationFileName)
public void Convert( int firstPageNumber, int lastPageNumber, string destinationFileName )
function Leadtools.Pdf.PDFFile.Convert( firstPageNumber , lastPageNumber , destinationFileName )
public: void Convert( int firstPageNumber, int lastPageNumber, String^ destinationFileName )
To use this method, associate this PDFFile object with a valid PDF file and optional password. You can achieve this by either using the PDFFile(string fileName) or PDFFile(string fileName, string password) constructurs or set the file name and optional password directly into the FileName and Password properties. You do not need to call Load before using this method.
This method can be used to work on all or portion of the pages in a PDF file. To use all the pages of a document, pass 1 and -1 for firstPageNumber and lastPageNumber.
This method will use the following properties of this PDFFile object:
DocumentProperties. If the value of this property is null (Nothing in Visual Basic), then default properties will be used
SecurityOptions. If the value of this property is not null (Nothing in Visual Basic), then the destination file will be encrypted using the properties of this property. If the value of this property is null (Nothing in Visual Basic), the result file will not be encrypted
CompatibilityLevel. The version of the generated PDF file
Public Sub PDFFileConvertExample() Dim sourceFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "LEAD.pdf") Dim destinationFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "LEAD_15.pdf") Dim pdfFileObj As New PDFFile(sourceFileName) pdfFileObj.DocumentProperties = New PDFDocumentProperties() Dim properties As PDFDocumentProperties = pdfFileObj.DocumentProperties properties.Author = "Me" properties.Creator = "My Application" properties.Title = "My Document" properties.Producer = "LEAD" properties.Subject = "My Subject" properties.Keywords = "Keyword1 Keyword2" properties.Created = DateTime.Now properties.Modified = DateTime.Now pdfFileObj.CompatibilityLevel = PDFCompatibilityLevel.PDF15 pdfFileObj.Convert(1, -1, destinationFileName) End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
public void PDFFileConvertExample() { string sourceFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD.pdf"); string destinationFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_15.pdf"); PDFFile pdfFile = new PDFFile(sourceFileName); pdfFile.DocumentProperties = new PDFDocumentProperties(); PDFDocumentProperties properties = pdfFile.DocumentProperties; properties.Author = "Me"; properties.Creator = "My Application"; properties.Title = "My Document"; properties.Producer = "LEAD"; properties.Subject = "My Subject"; properties.Keywords = "Keyword1 Keyword2"; properties.Created = DateTime.Now; properties.Modified = DateTime.Now; pdfFile.CompatibilityLevel = PDFCompatibilityLevel.PDF15; pdfFile.Convert(1, -1, destinationFileName); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2