If the section has only grid and you want to show that grid in pdf above would be good. If you have some other fields in your section along with grid to display in html. Break the your section into two sections like SectionA to display grid and SectionB with other stuff in section. And, call SectionB from your html along with the code above.
When you run this activity it attaches the pdf to the case and you can open from the attachments tab. If you don't want to attach it to the case just want to view try replacing the pyAttachAsPDF activity with OOTB other pdf activities and It should work.