Image to pdf conversion not work when using Aspose.Pdf

Hi

I am try to convert images to pdf in asp.net (Aspose.Pdf),only jpg to pdf convert and see data in pdf files.but others file can’t see data in pdf,just it show watermark in pdf.

only get conversion in pdf for jpg

jpg to pdf -----can get pdf with data
png to pdf—cant get
bmp to pdf —cant get
gif to pdf—cant get
tiff to pdf—cant get

pls see the zip files in that all format images and also converted pdf also available,
in imagwtopdf i write code for conversion.

note:if i try one by one also not get correct pdf conversion.

and i get code form
https://tutorials.aspose.com/pdf/net/programming-with-images/image-to-pdf/

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

Thanks for ur reply,now work fine,thanks a lot

Regards
Aravind

Hi Aravind,


Thanks for your feedback. It is good to know that you have managed to accomplish the requirement.

Please keep using our API and feel free to ask any question and concern. We will be more than happy to extend our support.

Best Regards,