-
Notifications
You must be signed in to change notification settings - Fork 2
Add Share PDF app extension example #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MariaPaulaGomezPrieto
merged 2 commits into
v2
from
docs/add-share-pdf-app-extension-example
Sep 8, 2026
+66
−1
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| --- | ||
| title: Share PDF | ||
| author: '' | ||
| excerpt: >- | ||
| Convert an extension's HTML to a PDF that users can save, share, or print from mobile. | ||
| deprecated: false | ||
| hidden: false | ||
| metadata: | ||
| title: '' | ||
| description: '' | ||
| robots: noindex | ||
| next: | ||
| description: '' | ||
| --- | ||
|
|
||
| App Extensions let you create focused workflows that make work easier for field users. Use them to present familiar, task-specific information without requiring people to leave the record they are completing. | ||
|
|
||
| This page shows how to add a **Share** button to an App Extension. When a mobile user taps the button, the app converts the extension's HTML into a PDF file and presents the platform-native Save, Share, or Print actions. | ||
|
|
||
| ## Share PDF | ||
|
|
||
| Use this when you want field users to generate a shareable, printable, or savable PDF snapshot of the information shown in an extension — for example a completed inspection ticket or a chain-of-custody record. | ||
|
|
||
| No changes are needed in the extension's HTML or JavaScript to support this. Any existing App Extension file works as-is — the Share button is controlled entirely by the Data Event, not by anything in the extension page itself. | ||
|
|
||
| ### Add the Share PDF Data Event | ||
|
|
||
| Configure the `OPENEXTENSION` data event by adding `actions: ['sharePDF']` to the `data` object. | ||
|
|
||
| ```js | ||
| ON('click', 'open_app_extension', () => { | ||
| OPENEXTENSION({ | ||
| url: 'attachment://sharePDF.html', | ||
| title: 'Share PDF Example', | ||
| data: { | ||
| record_id: RECORDID(), | ||
| actions: ['sharePDF'], | ||
| }, | ||
| onMessage: () => {}, | ||
| }); | ||
| }); | ||
| ``` | ||
|
|
||
| ### Enabling the Share Button | ||
|
|
||
| The Share button that lets users save, share, or print the generated PDF only appears when the Data Event's `data` object includes: | ||
|
|
||
| ```js | ||
| actions: ['sharePDF'] | ||
| ``` | ||
|
|
||
| If this array is omitted, or the value is misspelled, the extension will render normally but the Share button will not be visible, and users will have no way to export the content as a PDF. | ||
|
|
||
| ### How It Works | ||
|
|
||
| 1. The user taps the button configured with the `open_app_extension` Data Event. | ||
| 2. `OPENEXTENSION` loads the extension file and passes the record data, including the `actions: ['sharePDF']` flag. | ||
|
MariaPaulaGomezPrieto marked this conversation as resolved.
|
||
| 3. Because `sharePDF` is present in `actions`, the host app displays a Share button on the extension screen. | ||
| 4. When the user taps Share, the app converts the extension's rendered HTML into a PDF — no special code in the extension's HTML is required for this step. | ||
| 5. The user is presented with the platform-native Save, Share, or Print options for that PDF. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.