Free Support Forum - aspose.com

Html to Pdf How can i reference a image stream in the HTML?

I Really need do something like this


IN CODE:
MemoryStream grafico = GeradorDeGrafico.GerarGraficoBarra();
Aspose.Pdf.Generator.Image image = new Image(section);

image.ImageInfo.File = “SomeReferenceID”;
image.ImageInfo.ImageStream = grafico;
image.ID = SomeReferenceID;

IN HTML
<img src=SomeReferenceID />
Someone knows the way?

Hi Glauber,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.Pdf.

I am not clear about your requirement. If you are creating a PDF file from HTML document then HTML does not allow stream (or its reference id) in the src property in image tag. It requires image file path.

Now, in case you need to add image stream to PDF file, you can use first import HTML to PDF (using BindHTML method) and later you can add the image to PDF file. Please see the following documentation link with details regarding how to add image stream to PDF file.

Use Image from Memory

In case you have any other query, please do let us know.

Sorry for the inconvenience,