

TxtOutput.Text += " Processing folder: " & sFolderPath & " - " & iPageCount & " files." & vbCrLfĭim oFiles As String() = Directory.GetFiles(sFolderPath)ĭim oPdfDoc As New ()ĭim oPdfWriter As PdfWriter = PdfWriter.GetInstance(oPdfDoc, New FileStream(sOutFilePath, FileMode.Create)) If iPageCount > 0 And bOutputfileAlreadyExists = False Then " and could not be deleted." & vbTab & vbCrLfīOutputfileAlreadyExists = True End Try End If Dim iPageCount As Integer = GetPageCount(sFolderPath) TxtOutput.Text += " Output file already exists: " & sOutFilePath & _ pdf" End If If IO.File.Exists(sOutFilePath) Then Try SOutFilePath = & " \" & oFolderInfo.Name & ". pdf" If chkCreateInParentFolder.Checked Then IRet += 1 End If End Select Next Return iRetĮnd Function Sub ProccessFolder( ByVal sFolderPath As String)ĭim bOutputfileAlreadyExists As Boolean = False Dim oFolderInfo As New System.IO.DirectoryInfo(sFolderPath)ĭim sOutFilePath As String = sFolderPath & " \" & oFolderInfo.Name & ". IRet += 1 End If Case " JPG", " TIF" If sExt = " JPG" Or sExt = " TIF" Then IRet += 1 End If Case " PDF" If sExt = " PDF" Then IRet += 1 ElseIf sExt = " JPG" Or sExt = " TIF" Then

TxtOutput.Text += " Starting." & vbCrLfītnProcess.Enabled = True End Sub Private Function PadExt( ByVal s As String) As StringĮnd Function Function GetPageCount( ByVal sFolderPath As String) As Integer Dim iRet As Integer = 0 Dim oFiles As String() = Directory.GetFiles(sFolderPath)įor i As Integer = 0 To oFiles.Length - 1 Dim sFromFilePath As String = oFiles(i)ĭim oFileInfo As New FileInfo(sFromFilePath)ĭim sFileType As String = cbFileType.SelectedItemĭim sExt As String = PadExt(oFileInfo.Extension) Object, ByVal e As System.EventArgs) Handles btnProcess.ClickītnProcess.Enabled = False Dim sFromPath As String = txtFrom.Text Object, ByVal e As System.EventArgs) Handles btnFrom.ClickĮnd Sub Private Sub btnProcess_Click( ByVal sender As System. Object, ByVal e As System.EventArgs) Handles MyBase.LoadĬbFileType.SelectedIndex = 0 End Sub Private Sub btnFrom_Click( ByVal sender As System. Private Sub Form1_Load( ByVal sender As System.
