File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,35 @@ import { EmbedPDF } from '@simplepdf/react-embed-pdf';
120120/ > ;
121121```
122122
123+ ### Programmatic Control
124+
125+ _ Requires a SimplePDF account_
126+
127+ Use ` const { embedRef, actions } = useEmbed(); ` to programmatically control the embed editor:
128+
129+ - ` actions.submit ` : Submit the document (specify or not whether to download a copy of the document on the device of the user)
130+ - ` actions.selectTool ` : Select a tool to use
131+
132+ ``` jsx
133+ import { EmbedPDF , useEmbed } from " @simplepdf/react-embed-pdf" ;
134+
135+ const { embedRef , actions } = useEmbed ();
136+
137+ return (
138+ <>
139+ < button onClick= {() => await actions .submit ({ downloadCopyOnDevice: false })}> Submit< / button>
140+ < button onClick= {() => await actions .selectTool (' TEXT' )}> Select Text Tool< / button>
141+ < EmbedPDF
142+ companyIdentifier= " yourcompany"
143+ ref= {embedRef}
144+ mode= " inline"
145+ style= {{ width: 900 , height: 800 }}
146+ documentURL= " https://cdn.simplepdf.com/simple-pdf/assets/sample.pdf"
147+ / >
148+ < / >
149+ );
150+ ```
151+
123152### <a id =" available-props " ></a >Available props
124153
125154<table >
@@ -129,6 +158,12 @@ import { EmbedPDF } from '@simplepdf/react-embed-pdf';
129158 <th>Required</th>
130159 <th>Description</th>
131160 </tr >
161+ <tr >
162+ <td>ref</td>
163+ <td>EmbedRefHandlers</td>
164+ <td>No</td>
165+ <td>Used for programmatic control of the editor</td>
166+ </tr >
132167 <tr >
133168 <td>mode</td>
134169 <td>"inline" | "modal"</td>
You can’t perform that action at this time.
0 commit comments