Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

transform - rotate and scale is not working when i convert html content to pdf

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.

like image 944
Shail Paras Avatar asked Apr 02 '13 14:04

Shail Paras


People also ask

How do I rotate a Div 90 degrees?

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.

How do I rotate an image in HTML?

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.

How do you rotate text in HTML?

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.

How do I rotate an image 180 degrees CSS?

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.


2 Answers

use "-webkit-transform" instead of "transform". for example:

 -webkit-transform: rotate(90deg);
like image 178
Guangyu Wu Avatar answered Nov 09 '22 04:11

Guangyu Wu


try wkhtmltopdf, it works for css transforms also (but only with -webkit prefix)

https://code.google.com/p/wkhtmltopdf/

like image 27
Yogesh Khatri Avatar answered Nov 09 '22 04:11

Yogesh Khatri