I created a Visualforce page quick action on Opportunity object. It has an iframe to another visualforce page (renderAs='pdf'). The Visualforce Page action (parent) has a custom button to download the iframed Visualforce page. It works completely fine in the org.
I wanted to use this solution in Experience Cloud. I am testing this by logging into the community as a user with a Partner Community License.
So far I have managed to put all of this into the community so the action is working, and I am able to see the inner pdf without an issue.
The problem happens when I click the custom button to download this pdf. I got the following error:
The page you submitted was invalid for your session. Please refresh your page and try again.
And this old-school error page:
The error happens in the following code and at the last line.
PageReference pdfToSave = Page.AngebotPDF;
pdfToSave.getParameters().put('id', opportunity.Id);
BLOB pdfToSaveBLOB = pdfToSave.getContent();
As far as I understand the Partner Community Licensed user cannot access this pdf from the community. However, the user can see the preview fine and I enabled the page by checking the Available for Lightning Experience, Experience Builder sites, and the mobile app checkbox from the Visualforce pages.
I believe the problem occurs because I couldn't provide the correct PageReference for the user to access it and get its content via getContent().
Thank you for your help, Ozan