We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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
http://www.aspose.com/docs/display/pdfnet/How+to+++Convert+an+Image+to+PDF

Hi Aravind,


Thanks for your inquiry. We have manged to replicate the issue in Aspose.Pdf.Generator namespace, it is not capturing FileNotFound Exception against invalid image file path and logged a ticket as PDFNEWNET-37226 in our issue tracking system. If you provide correct Image file Path, conversion will work fine.

However we will recommend you to use Aspose.Pdf.Document class for image to PDF conversion. It is more efficient and improved approach. Please check following code snippet for the purpose.

Dim outFile As String = myDir + “imagetopdfDOM.pdf”<o:p></o:p>

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,