function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CloudHuggerCloudHugger 

pdf to attachment - rendering wrong page

Hi All,

 

Hoping this is a quick one - has me puzzled, hoping for someone to clip me over the ear for some obvious thing Im missing...

 

Am on a VF page called 'selectpages' and can click 'render to pdf' button. Button action is intended to simply render another VF page to an attachment as follows - 

 

Attachment ax = new attachment(name = filenameToUse, parentid = quot.id);

        

        PageReference bl = Page.tc_report;

        bl.getParameters().put('q',qid);

        bl.setRedirect(true);

        Blob b = bl.getContent();

        ax.Body = b;

        insert ax;

 

So why does the resulting attachment contain the 'selectpages' rendered nicely as a pdf and not the tc_report page?....

 

Weird!  Any pointers appreciated.

 

Cheers,

CH