Skip to content

Commit 01810ae

Browse files
authored
Merge pull request #116 from PSPDFKit/rad/update-getAnnotations-api-doc
Update API documentation for getAnnotations
2 parents 39a3ee2 + 8572ef5 commit 01810ae

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

android/src/main/java/com/pspdfkit/react/events/PdfViewDataReturnedEvent.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@ public class PdfViewDataReturnedEvent extends Event<PdfViewDataReturnedEvent> {
2424

2525
private final WritableMap payload;
2626

27-
public PdfViewDataReturnedEvent(@IdRes int viewId, int requestId, @NonNull List<Annotation> annotations) {
27+
public PdfViewDataReturnedEvent(@IdRes int viewId, int requestId, @NonNull List<Annotation> annotationsToSerialize) {
2828
super(viewId);
2929
Map<String, Object> map = new HashMap<>();
3030
map.put("requestId", requestId);
3131
try {
3232
List<Map<String, Object>> annotationsSerialized = new ArrayList<>();
33-
for (Annotation annotation : annotations) {
33+
for (Annotation annotation : annotationsToSerialize) {
3434
JSONObject instantJson = new JSONObject(annotation.toInstantJson());
3535
annotationsSerialized.add(JsonUtilities.jsonObjectToMap(instantJson));
3636
}
37-
map.put("result", annotationsSerialized);
37+
38+
Map<String, Object> annotations = new HashMap<>();
39+
annotations.put("annotations", annotationsSerialized);
40+
map.put("result", annotations);
3841
} catch (JSONException e) {
3942
map.put("error", e.getMessage());
4043
}

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class PSPDFKitView extends React.Component {
139139
* @param type The type of annotations to get (See here for types https://pspdfkit.com/guides/server/current/api/json-format/) or null to get all annotations.
140140
*
141141
* Returns a promise resolving an array with the following structure:
142-
* [instantJson]
142+
* {'annotations' : [instantJson]}
143143
*/
144144
getAnnotations = function (pageIndex, type) {
145145
if (Platform.OS === "android") {

0 commit comments

Comments
 (0)