EDIT:
I have no problem viewing the page and it does display the fields but my problem is when you generate content as pdf it does not show the visualforce page content in the PDF
I have a standard page and in that standard page layout I have added Custom Visualforce page and added a Detail Page Button at the top of the page layout. when the user clicks on the page it execute the code below to generate the PDF and attach to notes/attachments, all is good so far.
PageReference pagePdf = new PageReference('/'+parentId);
pagePdf.getParameters().put('id', parentId);
Attachment a = new Attachment();
a.Body = pagePdf.getContentAsPDF();
a.ParentID = parentId;
a.Name = 'Attach.pdf';
insert a;
The issue I see is that it does not generate visualforce page fields at all.
How do I solve this issue? any thoughts?