Free Support Forum - aspose.com

Unable to write image to PDF when using css float


#1

Hi,

In our application we have a requirement to write image to PDF.

As can be seen in the below attached files (Zip file has following 2 files, 1. Image + Text that we are converting to PDF 2. Program logic being used to convert to PDF)

When we have <img class=“note-float-left” **style=“float: left;”**​> inside image tag we are getting out of memory exception when saving document to local drive or to a memory stream​

If we remove the style="float: left;"​ from file we are able to write the content of ProblemImagetext​.txt to PDF ​properly.​

​Can you please let us know if ASPOSE.PDF supports CSS float attribute or not, If yes how to we use it when we have such text

https://www.w3schools.com/cssref/pr_class_float.asp

Thank You,
Aparna

ProblemHTMLPDF.zip (120.2 KB)


#2

@aparnabn

Thank you for contacting support.

We have worked with the data shared by you but have been unable to reproduce the exception. Generated PDF file has been attached for your kind reference output.pdf. Would you please ensure using Aspose.PDF for .NET 19.1 and then share your kind feedback with us.


#3

Hi Farhan,

Thank you for suggesting to move to 19.1

I am using ASPOSE.PDF 18.4.1 & see below error
image.png (28.0 KB)

When I used ASPOSE.PDF 19.1 i don’t see out of memory exception, but I have one doubt
Attaching the different 3 PDFs generated through ASPOSE

output19.1WithoutFloat.pdf (952.1 KB)
output18.4WithoutFloat.pdf (952.0 KB)
output19.1WithFloat.pdf (1.4 MB)

When you compare files output19.1withfloat.pdf with output19.1withoutfloat.pdf, in the last page there is an overlap of text on image. Is it possible to avoid this overlap, If yes how to do it

Thanks,
Kabir


#4

@aparnabn

Thank you for your kind feedback.

We are glad to know that you are not facing the exception anymore. Moreover, would you please share a sample HTML file which uses this property so that we may narrow down the problem and assist you accordingly.


#5

Hi Farhan,

If you open output19.1WithFloat.pdf in above article you would be able to see the overlapping text in Page 3.

The C# & HTML code to generate output19.1WithFloat.pdf is same as the one in first article. For reference I am attaching the code used once again

ProblemHTMLPDF.zip (120.2 KB)


#6

@aparnabn

Thank you for elaborating it further.

We have tested float property which is rendered fine by Aspose.PDF for .NET API. We have attached respective data for your kind reference. However, text overlaps in your files for which a ticket with ID PDFNET-46010 has been logged in our issue management system for further investigations. We will let you know as soon as some significant updates will be available.

float.zip