1、参照:https://blog.csdn.net/u011108093/article/details/81916318
C#使用itextsharp对pdf文件进行分割的几种方法(方法一)
2、将方法一的c#代码转换为VB.net:
Public Sub ExtractPages(ByVal sourcePdfPath As String, ByVal outputPdfPath As String, ByVal startPage As Integer, ByVal endPage As Integer)
Dim reader As PdfReader = Nothing
Dim sourceDocument As Document = Nothing
Dim pdfCopyProvider As PdfCopy = Nothing
Dim importedPage As PdfImportedPage = Nothing
Try
reader = New PdfReader(sourcePdfPath)
sourceDocument = New Document(reader.GetPageSizeWithRotation(startPage))
pdfCopyProvider = New PdfCopy(sourceDocument, New System.IO.FileStream(outputPdfPath, System.IO.FileMode.Create))
sourceDocument.Open()
For i As Integer = startPage To endPage
importedPage = pdfCopyProvider.GetImportedPage(reader, i)
pdfCopyProvider.AddPage(importedPage)
Next
sourceDocument.Close()
reader.Close()
Catch ex As Exception
Throw ex
End Try
End Sub
3、如果要打开的PDF文件路径:d:\ABC.pdf
打开的页面:5-7页
写入的新文件是:d:\123.pdf
上面的代码应该怎样修改使用?
谢谢!