Support for pdf and margin settings

I added support for pdf media, using iframe. And control over margins when size is % based (useful for mobile phones).
If you think this code is useful please add it to master branch.