3

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 :)

lfals
  • 61
  • 2
  • 5
  • 1
    I had the same issue last year, and I think there is no way to rotate text with flying saucer. `transform: rotate` is part of ccs3 and is not supported. – obourgain May 10 '13 at 15:06

3 Answers3

2

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.

Community
  • 1
  • 1
0

This isn't possible using flying saucer as far as I know, you could try using PhantomJS which is a more reliable way to go from HTML to PDF. To integrate with java you could run the webserver module and send your requests via a HTTP request to PhantomJS.

0

We had the same issue. Ended up creating an image in java with the text rotated and inserting the image as a base64 encoded string into the html. It sucks but it works

Tommy
  • 4,011
  • 9
  • 37
  • 59