Illustrator uses PDF or AICB for the clipboard. I am interested in filling in the clipboard from java as a PDF, then pasting it into Illustrator.
I thought it might be easier to try differently first. So copy from illustrator in java.
If you copy some circles in Illustrator, the getTransferDataFlavors method from Clipboard does not return any DataFlavors. And for all isDataFlavorSupported I get false.
import java.awt.datatransfer.*; import java.awt.Toolkit; public class ClipBoardTest { public static void main(String[] args) { Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable content = clipboard.getContents(null); if (content != null) { DataFlavor[] dataFlavors = content.getTransferDataFlavors(); for (DataFlavor df : dataFlavors) { System.out.println(df.getHumanPresentableName()); System.out.println("---"); } System.out.println(content.isDataFlavorSupported(DataFlavor.stringFlavor)); System.out.println(content.isDataFlavorSupported(DataFlavor.imageFlavor)); System.out.println(content.isDataFlavorSupported(DataFlavor.allHtmlFlavor)); System.out.println(content.isDataFlavorSupported(DataFlavor.fragmentHtmlFlavor)); System.out.println(content.isDataFlavorSupported(DataFlavor.selectionHtmlFlavor)); System.out.println(content.isDataFlavorSupported(DataFlavor.javaFileListFlavor)); DataFlavor myDF = new DataFlavor("application/pdf", "PDF"); System.out.println(content.isDataFlavorSupported(myDF)); } } }
exit:
false false false false false false false
I do not know what to do next. I have tried things over the past few hours, but it seems like it is not going anywhere. What can I do?
java clipboard adobe-illustrator
clankill3r
source share