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

Free Support Forum - aspose.com

Images appear as red x's

Hi,

I am creating a simple pdf that has an image at the top that is a URL - that appears fine, then I add several text objects to the section and finally, a second image. The second image is not appearing. The second image uses the same code as the top most image, which is puzzling. Should I add another section to the PDF???

The logic is pretty simple, sec1 is my section

Dim image2 As Aspose.Pdf.Image = New Aspose.Pdf.Image(sec1)
sec1.Paragraphs.Add(image2)
image2.ImageInfo.File = ret ’ ret is either an URL or disk - I have tried both approaches
image2.ImageInfo.ImageFileType= fType ’ determined by a separate function

We are using version 3.6.2.0 of the aspose PDF Dll BTW. Any thoughts on why this does not work? Please response asap - I need this working by Monday if possible.

Hello Karl,

I have tested the scenario over my end and I am able to generate the Pdf containing 2 images and text objects in same section.

Dim pdf1 As Pdf = New Pdf()
Dim sec1 As Section = pdf1.Sections.Add()
Dim image1 As Aspose.Pdf.Image = New Aspose.Pdf.Image(sec1)
sec1.Paragraphs.Add(image1)
image1.ImageInfo.File = "C:/pdftest/Aspose.jpg"
image1.ImageInfo.ImageFileType = ImageFileType.Jpeg

Dim text1 As Aspose.Pdf.Text = New Aspose.Pdf.Text
sec1.Paragraphs.Add(text1)
text1.Segments.Add("This is a Sample Text")

Dim text2 As Aspose.Pdf.Text = New Aspose.Pdf.Text
sec1.Paragraphs.Add(text2)
text2.Segments.Add("Second example of Sample Text")

Dim image2 As Aspose.Pdf.Image = New Aspose.Pdf.Image(sec1)
sec1.Paragraphs.Add(image2)
image2.ImageInfo.File = "C:/pdftest/Aspose_Pdf-Product-Box.jpg"
image2.ImageInfo.ImageFileType = ImageFileType.Jpeg

pdf1.Save("C:\\pdftest\\TwoImagesinSection.pdf")

The output pdf is in attachment. If it does not resolve your issue, kindly share the code file.

Well on my end, this isnt happening so I have a few questions -

To incorporate large (1mb+) bmp, tif and jpeg images, does aspose PDF need write access to any scratch or temp directories or anything along those lines?

Most of the images I am integrating are large medical images - I am wondering if the issue is file size and/or resources?

I have attached a resulting PDF. View pages 5 or 7 to see the Red X I mention. I have triple checked and our pathing to these is correct and for example, The image for page 7 can be directly viewed by visiting this URL (which is what we are passing to our pdf creation routine).

http://www.isshp2008-washington.org/Uploads/300/82/risffactv3chart.gif

These images are available in a public folder, without any need to login and authenticate which I believe rules out any security related issues. So please help me figure this one out. As you indicate, the code approach is fine, but for whatever reason, the iamges are not incorporated correctly.

Hi,

I found the image is not supported well. I have logged this issue as PDFNET-5359. We will try to fix it ASAP.

Thanks - we are also doing .BMP, .TIF too and those dont work either. Hoping the fix comes soon. Need this up this week.

Hi,

Sorry for my mistake. I checked it again and I found the image is supported without problem.

Aspose.Pdf does not need to write access to any scratch or temp directories.

The red x means the image is not found or can't be accessed. I am not sure if it is caused by network problem when accessing the web image. Can you please provide a simple project that can reproduce this error?