PDI practice question 12 of 30
Which code displays the contents of a Visualforce page as a PDF?
Full set: 201 questionsThe component's renderAs attribute is used to change the rendering service and output format of a Visualforce page. To generate a PDF document, the value of this attribute must be set to "pdf". This instructs the Salesforce platform to process the Visualforce markup and render it as a PDF file instead of the default HTML. The contentType attribute is used to specify the MIME type, but renderAs is the designated attribute for this transformation.
A. The contentType attribute specifies the MIME type, but renderAs is the correct attribute to invoke the PDF rendering service.
B. The contentType attribute requires a valid MIME type. "pdf" is not a valid MIME type; "application/pdf" is.
D. The renderAs attribute accepts specific keywords (like "pdf", "xls", "doc"), not full MIME type strings like "application/pdf".
1. Salesforce Visualforce Developer Guide: In the component reference, the renderAs attribute is described. It states, "The rendering service to use for the page... Possible values are: pdf, doc, xls, xml, csv." This directly supports the use of renderAs="pdf".
Source: Visualforce Developer Guide, Component Reference, , renderAs attribute description.
2. Salesforce Trailhead: The "Visualforce Basics" module explains how to create Visualforce pages. The specific unit on "Creating a PDF from a Visualforce Page" demonstrates the use of .
Source: Trailhead, Visualforce Basics, "Generate PDFs and Emails".
Keep practicing
Take the free PDI practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PDI practice questions
- Question 1What can be used to override the Account's standard Edit button for Lightning Experience?
- Question 4Universal Containers (UC) wants to lower its shipping cost while making the shipping proc…
- Question 5A developer has an integer variable called maxAttempts. The developer needs to ensure tha…
- Question 7Universal Containers wants to back up all of the data and attachments in its Salesforce o…
- Question 8Universal Containers hires a developer to build a custom search page to help users find t…
- Question 9As part of new feature development, a developer is asked to build a responsive applicatio…
