The Bit&Black Autoprefixer for PrintCSS library is designed to deal with the lack of a standard that makes writing CSS sometimes difficult. Depending on which renderer is to be used, the writings differ considerably.
This library was written in PHP and requires a token before it can be installed. The use of the library is subject to a fee.
Once you received a token you can add the library to your project by running $ composer require bitandblack/printcss-autoprefixer
.
Tell the autoprefixer which vendor is to use at first:
<?php
use BitAndBlack\PrintCSS\AutoPrefixer\AutoPrefixer;
use BitAndBlack\PrintCSS\AutoPrefixer\Vendor\PDFreactor;
AutoPrefixer::setPrefixVendors(
new PDFreactor()
);
Handle your CSS now:
<?php
$css = '
@page {
media-size: 210mm 297mm;
}
';
$cssPrefixed = (string) new AutoPrefixer($css);
/**
* Will echo
*
* ```
* @page {
* media-size: 210mm 297mm;
* -ro-media-size: 210mm 297mm;
* }
* ```
*/
echo $cssPrefixed;