Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotate text with flying saucer to pdf

I´m using flying saucer and itext to convert html to pdf, in the order to write text in vertical orientation, i try the simple css:

style="writing-mode: tb-rl";

the transform rotations for browsers:

transform: rotate(270deg)!important;  
-ms-transform:rotate(270deg); /* IE 9 */
-moz-transform:rotate(270deg); /* Firefox */
-webkit-transform:rotate(270deg); /* Safari and Chrome */
-o-transform:rotate(270deg); /* Opera */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11=0.7071067811865476, M12=-0.7071067811865475, M21=0.7071067811865475, M22=0.7071067811865476); /* IE6,IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand', M11=0.7071067811865476, M12=-0.7071067811865475, M21=0.7071067811865475, M22=0.7071067811865476)"; /* IE8 */

But with no success... :(

Same one know how to rotate the html text, with flying saucer and itext?

Thanks in advance :)

like image 575
lfals Avatar asked Oct 31 '25 22:10

lfals


1 Answers

I've been doing some digging around. From the FlyingSaucer User forums, it seems like the transform property is not supported yet. However it should be easier to implement as it does not affect layout.

If you are not interested in digging into source, you can implement a replaced element to take in the data, convert to SVG and use it in your layout. Here are few examples of similar usage for barcode. http://andreas.haufler.info/2012/12/generating-barcodes-in-pdfs-with-flying.html

There is another code example here - Using Flying Saucer to Render Images to PDF In Memory

Using browser-engine backed libraries like PhantomJS might not be ideal when your entire application is in Java.

like image 84
Sai Chaitanya Avatar answered Nov 04 '25 01:11

Sai Chaitanya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!