ExportString có thể xuất EMF hoặc GIF không? Trong streamoutput.emf demo này bằng cách nào đó được đọc sai:Chuyển đổi đồ họa bằng ExportString
Quiet[DeleteFile["C:\\Temp\\thisworks.emf"]];
Quiet[DeleteFile["C:\\Temp\\streamoutput.emf"]];
graphic = Graphics[{Thick, Red, Circle[{#, 0}] & /@ Range[4],
Black, Dashed, Line[{{0, 0}, {5, 0}}]}];
Export["C:\\Temp\\thisworks.emf", graphic, "EMF"];
file = ExportString[graphic, "EMF"];
stream = OpenWrite["C:\\Temp\\streamoutput.emf", BinaryFormat -> True];
Write[stream, file];
Close[stream];
Nếu ExportString làm việc tôi có thể có thể sử dụng nó để chuyển EMFs qua netlink, ví dụ
kernel.Compute("ExportString[Graphics[Rectangle[]], \"EMF\"]");
File.WriteAllText("C:\\Temp\\output.emf", kernel.Result.ToString());
Phụ Lục
Got mà làm việc.
kernel.Compute("ExportString[Graphics[Rectangle[]],{\"Base64\",\"EMF\"}]");
byte[] decodedBytes = Convert.FromBase64String(kernel.Result.ToString());
File.WriteAllBytes("C:\\Temp\\output.emf", decodedBytes);
Tôi xác nhận rằng giải pháp này cũng hoạt động cho EMF trên Windows. – WReach
Cảm ơn, Heike. EMF cũng hoạt động. –