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

Free Support Forum - aspose.com

Error with Aspose.pdf.Image: This stream does not support seek operations

Hi,

When we try to use Aspose.pdf.Image to create an image from web, we get the following error: "This stream does not support seek operations." at pdf.Save().

Reference: http://www.aspose.com/Products/Aspose.Pdf/Guide/Image.html

This issue is replicable in all version of Aspose dll.

Second issue: If we use any other method (say, Image from Memory stream), the image is overlapping on the text.

PF the code sample below:

Pdf pdf1 = new Pdf();

Section sec1 = new Section(pdf1);

pdf1.Sections.Add(sec1);

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image(sec1);

image1.ImageInfo.File = @"http://png-2.findicons.com/files/icons/1759/isabi4/128/adobe_acrobat_reader.png";

image1.ImageInfo.ImageFileType= ImageFileType.Png;

Text t1 = new Text("Aspose.Words for .NET is a class library that enables your applications to perform a great range of document processing tasks. Aspose.Words supports DOC, DOCX, RTF, HTML, OpenDocument, PDF, XPS, EPUB and other formats. With Aspose.Words you can generate, modify, convert, render and print documents without utilizing Microsoft Word.");

Text t2 = new Text("Aspose.Words for .NET is a class library that enables your applications to perform a great range of document processing tasks. Aspose.Words supports DOC, DOCX, RTF, HTML, OpenDocument, PDF, XPS, EPUB and other formats. With Aspose.Words you can generate, modify, convert, render and print documents without utilizing Microsoft Word.");

t1.ID = "para1";

sec1.Paragraphs.Add(t1);

sec1.Paragraphs.Add(image1);

sec1.Paragraphs.Add(t2);

pdf1.Save(@"C:\aspose.pdf");

Please help us resolving this issue.

Thanks

Hello Naresh,

Thanks for using our products.

I have tested the scenario with Aspose.Pdf for .NET 4.5.0 while using the code snippet that you have shared and I am unable to notice the problem. The image and text elements are properly being placed. Please take a look over the attached PDF document Scenario1_ImageIssueTest.pdf.

Regarding second scenario, If we use any other method (say, Image from Memory stream), the image is overlapping on the text. I have tried reading the contents of an image file into FileStream object and have passed them to Image.ImageInfo.ImageStream object and I am unable to notice the problem. Please take a look over the attached PDF document Scenario2_ImageIssueTest.pdf.

FileStream fs = new FileStream(@"d:/pdftest/Aspose.jpg", FileMode.Open);
image1.ImageInfo.ImageStream = fs;

In case I have not properly understood your requirement or you have any further query, please feel free to contact. We apologize for your inconvenience.

Hi,

Attached is a solution to replicate this issue.
<span style=“font-size: 10pt; font-family: “Courier New”;”>

Please help us in resolving this issue.


Thanks.

Hello Naresh,

Thanks for sharing the sample project.

I have noticed that in your shared project, you are using Aspose.Pdf for .NET 3.0.2.1 and when I have tested the scenario with this version, I am able to notice the same issue.

However, I have also tested the scenario using Aspose.Pdf for .NET 4.6.0 and I am unable to notice any problem. The resultant PDF is being generated without any problem. Please try using the latest release version of Aspose.Pdf for .NET 4.6.0 which can be downloaded from here.

In case you still face any problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

Hi Nayyer,

Thanks for your support.

The latest version 4.6.0.0 did fix the issue. For our better understanding, can you please share the possible reason and solution for this issue?

Thanks.

Hello Naresh,

I am pleased to hear that your problem is resolved. As per my understandings, in recent versions of Aspose.Pdf for .NET, we have fixed some issues related to addition of images from web location. So I think this might have also resolved this problem.

In case you have any further query, please feel free to contact.