Hi all,
I have a directory folder with PDF images files: 1234567.pd, 7654321.pdf, 3212345.pdf, 9876321.pdf. 
Now, see my code below (everything in the code is working  good), except that I am trying to search for the image file number doesn’t exist in that directory.
 
<table><tr><td>
<asp:Label 
    ID="lblImageFileNumber" 
    runat="server">Entry Number:</asp:Label>
 
</td>
<td >
<asp:TextBox 
    ID="TextImageFileNum" 
    runat="server" 
    MaxLength="8" 
    Font-Names ="Arial"
    Font-Size =" 11pt"
    Font-Bold ="False"
    ForeColor ="#092f64"/>
</td>
<td >
<asp:Button 
    ID="btnSearchImageNum" 
    runat="server" 
    Text="Search" 
   OnClick =" btnSearchImageNum_OnClick"/>
</td</tr></table>
Protected Sub btnSearchImageNum _Click(sender As Object, e As EventArgs)
              getImageFileNumberPDF()
End Sub
Public Function getImageFileNumberPDF () As String
‘If Img file number does exist
If textImageFileNum.Text <> String.Empty  Then
   
   Dim ImgFile As String = TextImageFileNum.Text.Trim()
   Dim objPDF As PdfManager = New PdfManager()
   objPDF = New PdfManager()
   Dim objDocImage As PdfDocument = objPDF.OpenDocument(Server.MapPath("~\XXX-Images\" & ImgFile & ".pdf")) -  Error stops here if the image file doesn’t exist
‘Image file that will save to the Temporary cache 
 Dim cachePath As String = Server.MapPath("cache") + "\" & ImgFile & ".pdf"
 Dim strFilename As String = objDocImage.Save(cachePath, False)
‘If the Image File Doesn’t exist
Else
Response.Redirect("http://www.microsoft.com ") or Error Message
End If
For example If the image file pdf number: 4455668.pdf doesn’t exist in that folder it will redirect or display error.
This is not happening I am getting an error that says: AspPDF.NET 2.1.0.15816 has generated error #110: [ Could not find a part of the path 'C:\XXXX-Image\4455668.pdf', which means the image file number doesn’t exist in the path directory. Yes, the error is correct, there is not image file number I type.
Your help is appreciated. Thanks.