         return true
     }
 
+    func save(_ data: Data, to destination: URL, withExtension pathExtension: String) throws -> String {
+        let name = self.name.replacingOccurrences(of: "/", with: "-")
+        var filename = name + "." + pathExtension
+        var num = 1
+        var url = destination.appendingPathComponent(filename)
+        while (try? url.checkResourceIsReachable()) == true {
+            num += 1
+            filename = "\(name) \(num).\(pathExtension)"
+            url = destination.appendingPathComponent(filename)
+        }
+        try data.write(to: url)
+        return filename
+    }
+
     override func namesOfPromisedFilesDropped(atDestination dropDestination: URL) -> [String]? {
         Swift.print("dropDestination: \(dropDestination)")
         guard let image = self.image else { return nil }
-        let name = self.name.replacingOccurrences(of: "/", with: "-")
-        var filename = name + ".png"
-        var num = 1
-        var url = dropDestination.appendingPathComponent(filename)
-        while (try? url.checkResourceIsReachable()) == true {
-            num += 1
-            filename = "\(name) \(num).png"
-            url = dropDestination.appendingPathComponent(filename)
-        }
+
         do {
-            try image.pngData().write(to: url)
-            return [filename]
+            return try [
+                self.save(image.pngData(), to: dropDestination, withExtension: "png"),
+                self.save(image.pdfData(), to: dropDestination, withExtension: "pdf")
+            ]
         }
         catch {
             return nil

//

import Cocoa

extension NSImage {
    func pngData() -> Data {

            return [iconComponent]
        }

        dragPromisedFiles(ofTypes: ["png", "pdf"],
                          from: CGRect(x: start.x - 26, y: start.y - 12, width: 32, height: 32),
                          source: self, slideBack: true, event: downEvent)

