There is no difference for this if you run preview or not. I guess your data are different when running from your app and that is why the result is also different.

Unfortunately, there is nothing we can do about such problems as it is specific for the particular pdf renderer.
I believe you use phantom-pdf right? You can try to search phantomjs repository if there is this problem mentioned and hope there is a workaround.
https://github.com/ariya/phantomjs/issues