Hi
Hi Aravind,
Thanks for your inquiry. We have managed to replicate the issue in Aspose.Pdf.Generator namespace; it is not capturing FileNotFoundException
against invalid image file path and logged a ticket as PDFNEWNET-37226 in our issue tracking system. If you provide the correct Image file Path, the conversion will work fine.
However, we will recommend you to use Aspose.Pdf.Document
class for image to PDF conversion. It is a more efficient and improved approach. Please check the following code snippet for this purpose.
Dim outFile As String = myDir + "imagetopdfDOM.pdf"
Dim inFile As String = myDir + "WWWJPEG1.jpg"
Dim doc As New Document()
' Create and add new page in Pages Collection
Dim page As Page = doc.Pages.Add()
' Set page margin
page.PageInfo.Margin.Bottom = 0
page.PageInfo.Margin.Top = 0
page.PageInfo.Margin.Left = 0
page.PageInfo.Margin.Right = 0
page.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height
page.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width
' Create an image object
Dim image1 As New Aspose.Pdf.Image()
' Add the image into paragraphs collection of the section
page.Paragraphs.Add(image1)
image1.File = inFile
' Save PDF file
doc.Save(outFile)
Please feel free to contact us for any further assistance.
Best Regards,
Hi
Hi Aravind,