I am using html2pdf to convert HTML content with images to PDF and I have also added an option to rotate and flip the images...
Right now pdf is created successfully ... but if I have rotated or flipped any image by using CSS
transform: rotate(90deg);
transform:scaleX(-1);
then in a PDF file, that image is not looking rotated or flipped... Any idea to get rid of this issue... Please share ...or any solution for that.
Thanks in Advance.
An element can be rotated 90 degrees by using the transform property. This property is used to move, rotate, scale and others to perform various kinds of transformation to elements. The rotate() transformation function can be used as the value to rotate the element.
Approach: You can use rotate() function defined as a transformation that rotates an element around a fixed point on the 2D plane, without deforming it. It takes one parameter which defines the rotation angle. The rotation angle consists of two parts, the value of the rotation followed by the unit of rotation.
Rotate text can be done by using the rotate() function. We can rotate the text in a clockwise and anti-clockwise directions. The rotate function can also rotate HTML elements as well.
Rotating images in real-time with the rotate parameter To rotate the image by 180 degrees, we need to add rt-180 transformation parameter to the URL, as shown below. The resulting image is the same as passing 180deg to the rotate function in CSS.
use "-webkit-transform" instead of "transform". for example:
-webkit-transform: rotate(90deg);
try wkhtmltopdf, it works for css transforms also (but only with -webkit prefix)
https://code.google.com/p/wkhtmltopdf/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With