1

I'm using the @page rule to set specific options for pages.

I just found out that you can also define different properties for different pages by naming them. That would be quite useful, but it doesn't seem to work. Although I can see that iText correctly interprets my named page and stores the name (I can tell, by monitoring CssPageSelectorParser and CssPageTypeSelectorItem), it seems to ignore the page property though, that is used to select which page to use.

Something like this should work, but it doesn't.

@page narrow { 
  size: 9cm 18cm;
}
@page rotated { 
  size: landscape; 
}
div { 
  page: narrow; 
}
table { 
  page: rotated; 
}

Is there any way of getting this to work or does this feature simply not work?

Cheers,
--Zuzu_Typ--

Zuzu_Typ
  • 97
  • 7
  • This feature is not supported for now. You can refer to my answer [here](https://stackoverflow.com/questions/62778803/how-to-get-a-landscape-orientation-for-only-some-pages-while-converting-html-to/62804690#62804690) to see a potential way to implement similar functionality – Alexey Subach Aug 19 '20 at 19:25
  • Thanks! I'm already using your mentioned code to display pages in landscape orientation, the downsides are that you have to write a decent chunk of custom code to achieve it and that you loose the ability of using SVGs in your document (because `convertToElements()` can't hold SVG information). Having the 'page' property would make a bunch of things a lot simpler for end users. Having different headers / footers for specific pages (which isn't really possible currently), changing the page orientation on the fly, even possibly changing the entire page size / format. I'm looking forward to it. – Zuzu_Typ Aug 20 '20 at 06:17

0 Answers0