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

Free Support Forum - aspose.com

HTML to PDF - position:absolute

Hello,

I am trying to convert the following HTML to PDF using Aspose PDF for Java 9.3.1






<img src=“http://upload.wikimedia.org/wikipedia/en/b/b4/Wh_14_row_beach.jpg

style=“position:absolute;left:35px;top:103px;z-index:5;width:500;” />

<img src=“http://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Smiley.svg/220px-Smiley.svg.png

style=“position:absolute;left:362px;top:84px;z-index:6;width:125;” />



<img src=“http://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Smiley.svg/220px-Smiley.svg.png

style=“position:absolute;left:116px;top:783px;z-index:6;width:125;” />




As you can see, the images are absolutely positioned and layered on top of each other. I have seen references in past Aspose PDF forum posts to absolutely positioned images, but the output does not seem to support it. Using the following code:



<cfset variables.license = createObject(“java”,“com.aspose.pdf.License”).init()>

<cfset variables.license.setLicense(licenseFile) />
<cfset var htmlLoadOptions=createObject(“java”,“com.aspose.pdf.HtmlLoadOptions”).init()>
<cfset pdf=createObject(“java”,“com.aspose.pdf.Document”).init(tempHTMLFile,htmlLoadOptions)>
<cfset pdf.save(tempPDFFIle)>

The saved PDF shows the images lined up one after the other, and not absolutely positioned.

Can you tell me if Aspose PDF is intended to support absolute positioning in HTML?

Further, does Aspose PDF support CSS3 properties such as rotation?

Thank you.

hi there, try to convert position style from ‘absolute’ to ‘relative’(change the ‘top’ attribute mainly), most of pdf convertors couldn’t handle absolute position, but relative.

Hi Chris,


We are testing this scenario and will get back to you soon. We are sorry for this inconvenience.

Thank you Nayyer.

xjdawu, thank you for the suggestion, but we need to position relative to the top left corner. Relative positioning positions the element relative to its normal position in the document flow. Even if it did render via Aspose, we need to set absolute coordinates.



Hi Chris,

We are sorry for the inconvenience caused. While testing the scenario with the latest version of Aspose.Pdf for Java 9.3.1, we have managed to reproduce the reported issue of CSS position property and logged it in our bug tracking system as PDFNEWJAVA-34409 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

Thank you. Can you specify whether CSS3 properties, particularly rotation, should be supported as well?

backprop:
Thank you. Can you specify whether CSS3 properties, particularly rotation, should be supported as well?
Hi Chris,

Please share the list of CSS3 properties (better share HTML), so that we can further investigate their support at our end.

Specifically I’m wondering about transforms such as rotation, e.g.





div {
transform: rotateZ(25deg);
transform-origin: bottom left;
}










Thank you.
backprop:
Specifically I'm wondering about transforms such as rotation, e.g.





div {
transform: rotateZ(25deg);
transform-origin: bottom left;
}










Thank you.
Hi Chris,

Thanks for sharing details.

I am afraid the feature is currently not supported. For the sake of correction, I have logged it in our issue tracking system as PDFNEWJAVA-34413. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFNEWJAVA-34409) have been fixed in Aspose.Pdf for Java 10.8.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.