I have everything working normally in my sandbox (render as pdf on a vf page), but when I copied everything and paste inside my prod, I have a pdf that look likes this when I render it as pdf

enter image description here

If I don't render it as pdf, I have something weird at the beginning of the page :

    <script src="/static/111213/js/perf/stub.js" type="text/javascript"></script><script>(function(UITheme) {
    UITheme.getUITheme = function() { 
        return UserContext.uiTheme;
}(window.UITheme = window.UITheme || {}));</script><meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE" />
<meta HTTP-EQUIV="Expires" content="Mon, 01 Jan 1990 12:00:00 GMT" />

If instead of calling the page from a method with getcontentaspdf, I go directly to the page and use renderas pdf, then it is working.

THe problem comes from getcontentaspdf. I am system admin on the system. Is there any others rights I need to set up ?

  • Have you tried deploying the VF page with a change set? – David Cheng Aug 30 '19 at 14:23
  • Not possible as My sandbox was part of another salesforce environment. I am creating everything like its new – Tibgg Aug 30 '19 at 14:30
  • Since your environment isn't a copy of their environment, you need to create a sandbox in their org and test the page there. – David Cheng Aug 30 '19 at 17:35

Found the solution.

Needed for chrome to add applicationpdf.ContentType = 'application/pdf';

instead of applicationpdf.ContentType = '.pdf';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.