---
schema_version: "1"
id: 180482750bb6240bec586bb7bf558a5db8af15c19eaabb33507f8ad3fb280883
title: getContent()
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_System_PageReference_getContent.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_System_PageReference_getContent.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7decb2ca608eca4eb960272120e8a551a0d9d0ab5b8d1de9b0e8cf15bb133f55
description: Returns the output of the page, as displayed to a user in a web browser.
---
# getContent()

Returns the output of the page, as displayed to a user in a web browser.

## Signature

public Blob getContent()

## Return Value

Type: [Blob](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_blob.htm#apex_methods_system_blob "Contains methods for the Blob primitive data type.")

## Usage

The content of the returned Blob depends on how the page is rendered. If the page is rendered as a PDF file, it returns the PDF document. If the page isn’t rendered as PDF, it returns HTML. To access the content of the returned HTML as a string, use the toString Blob method. If the Visualforce page has an error, an ExecutionException is thrown.

You can’t use the getContent method in:

- Triggers
- Test methods. If you use getContent in a test method, the test method fails. getContent is treated as a callout in API version 34.0 and later.
- Apex email services

You also can’t use the method to retrieve the output of a different Visualforce page with the same controller and controller extensions. Instead, pass the base URL of the destination page. Here, _VisualforcePageName_ is a placeholder value.

new PageReference(Site.getBaseUrl() + '/apex/VisualforcePageName').getContent();