Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ package com.pspdfkit.flutter.pspdfkit
/// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
/// This notice may not be removed from this file.
///
import android.os.Bundle
import android.view.View
import com.pspdfkit.annotations.AnnotationType
import com.pspdfkit.annotations.configuration.StampAnnotationConfiguration
import com.pspdfkit.annotations.stamps.StampPickerItem
import com.pspdfkit.document.PdfDocument
import com.pspdfkit.ui.PdfUiFragment

Expand All @@ -25,5 +30,18 @@ class FlutterPdfUiFragment : PdfUiFragment() {
super.onDocumentLoaded(document)
// Notify the Flutter PSPDFKit plugin that the document has been loaded.
EventDispatcher.getInstance().notifyDocumentLoaded(document)
val items = listOf(
StampPickerItem.fromTitle(requireContext(), "Great!").build(),
StampPickerItem.fromTitle(requireContext(), "Stamp!").build(),
StampPickerItem.fromTitle(requireContext(), "Like").build()
)
// Available stamps can be configured through the `PdfFragment`.
requirePdfFragment().annotationConfiguration.put(
AnnotationType.STAMP,
StampAnnotationConfiguration.builder(requireContext())
// Here you set the list of stamp picker items that are going to be available in the stamp picker.
.setAvailableStampPickerItems(items)
.build()
)
}
}
11 changes: 11 additions & 0 deletions ios/Classes/PspdfkitPlatformViewImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,17 @@ public class PspdfkitPlatformViewImpl: NSObject, PspdfkitWidgetControllerApi, PD
selector: #selector(spreadIndexDidChange(_:)),
name: .PSPDFDocumentViewControllerSpreadIndexDidChange,
object: nil)

var stamps = [StampAnnotation]()
let stampNames = ["Great!", "Stamp", "Like"]

for name in stampNames {
let stampAnnotation = StampAnnotation(title: name.uppercased())
let suggestedSize = stampAnnotation.sizeThatFits(CGSize(width: 200, height: 100))
stampAnnotation.boundingBox = CGRect(x: 0, y: 0, width: suggestedSize.width, height: suggestedSize.height)
stamps.append(stampAnnotation)
}
StampViewController.defaultStampAnnotations = stamps
}

@objc public func unRegister(binaryMessenger: FlutterBinaryMessenger){
Expand Down