import Foundation import PencilKit /// Coordinates are PDF points, measured from the bottom-left of the media box. struct PDFSignaturePlacement: Equatable, Sendable { let pageIndex: Int let bounds: CGRect } @MainActor protocol PDFSigningService { func sign(source: URL, drawing: PKDrawing, placement: PDFSignaturePlacement) async throws -> URL } enum PDFSigningError: LocalizedError { case invalidDocument, emptySignature, invalidPlacement, saveFailed var errorDescription: String? { switch self { case .invalidDocument: "Die PDF konnte nicht gelesen werden." case .emptySignature: "Bitte zuerst unterschreiben." case .invalidPlacement: "Für dieses Dokument fehlt eine gültige Unterschriftsposition." case .saveFailed: "Die unterschriebene PDF konnte nicht gespeichert werden." } } }