Illustrator uses either PDF and AICB for the clipboard. I'm interested in filling the clipboard from within java as PDF to then be able to paste it in Illustrator.
I thought it's probably more easy to first try to other way around. So copy from illustrator to java.
If i copy some circles in Illustrator, then the method getTransferDataFlavors
from the Clipboard
doesn't return any DataFlavors.
And for all isDataFlavorSupported
I get a 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));
}
}
}
output:
false
false
false
false
false
false
false
I'm clueless of what to do next. I have been trying things for the last few hours but it doesn't seem to lead anywhere. What could I do?