Peter Panino Posted October 21, 2023 Posted October 21, 2023 I have this SVG text in the clipboard: <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;"><rect x="0" y="0" width="200" height="200" style="fill:#f1f1f1;"/><g><text x="37.63px" y="165.586px" style="font-family:'Verdana', sans-serif;font-size:180.416px;">S</text><path d="M159.243,27.183l-118.486,145.634" style="fill:none;fill-rule:nonzero;stroke:#f00;stroke-width:12.39px;"/></g></svg> How can I paste it as a new SVG in Designer 2.2.1? Quote
lepr Posted October 21, 2023 Posted October 21, 2023 (edited) File > New From Clipboard Edit: that's Affinity on macOS Edited October 21, 2023 by lepr Quote
v_kyr Posted October 21, 2023 Posted October 21, 2023 You may also want to check under the Affinity Designer Preferences, the "General section" there and if "Copy items as SVG" is enabled or disabled there. Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
Peter Panino Posted October 22, 2023 Author Posted October 22, 2023 23 hours ago, lepr said: File > New From Clipboard Unfortunately, that does not work on Designer 2.2.1 for Windows: https://app.screencast.com/D1ZS3UvQCAbhN Quote
Peter Panino Posted October 22, 2023 Author Posted October 22, 2023 22 hours ago, lacerto said: On Windows, this does not seem to work (at least in 2.2.1), but if I paste the referred code on an existing document and then copy the resulting SVG rendering, I can paste as a new document. It seems that Designer currently only supports its INTERNAL CLIPBOARD. Is it that difficult to implement Windows clipboard support? I do it with my own apps all the time. Quote
Peter Panino Posted October 22, 2023 Author Posted October 22, 2023 These are the clipboard formats when I copy the SVG text from Notepad as shown in my own clipboard app (not yet published): https://app.screencast.com/abtGL0Cpkq1Jn Quote
Old Bruce Posted October 22, 2023 Posted October 22, 2023 On 10/21/2023 at 7:39 AM, Peter Panino said: I have this SVG text in the clipboard: ... How can I paste it as a new SVG in Designer 2.2.1? Paste it into a Plain Text text file and change the file extension from .txt to .svg. Open the svg in Designer. untitled text.svg Quote Mac Pro (Late 2013) Mac OS 12.7.6 Affinity Designer 2.6.0 | Affinity Photo 2.6.0 | Affinity Publisher 2.6.0 | Beta versions as they appear. I have never mastered color management, period, so I cannot help with that.
walt.farrell Posted October 22, 2023 Posted October 22, 2023 17 minutes ago, Peter Panino said: These are the clipboard formats when I copy the SVG text from Notepad as shown in my own clipboard app (not yet published): https://app.screencast.com/abtGL0Cpkq1Jn By the way, if you're going to show a screenshot, please just paste it into your post as a PNG or JPG image. Don't make us go someplace else. Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Laptop 2: Windows 11 Pro 24H2, 16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU iPad: iPad Pro M1, 12.9": iPadOS 18.3.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1
Peter Panino Posted October 22, 2023 Author Posted October 22, 2023 1 hour ago, Old Bruce said: Paste it into a Plain Text text file and change the file extension from .txt to .svg. Open the svg in Designer. Too much work. Why don't the Designer developers write a few code lines to implement this simple feature? Quote
MikeW Posted October 22, 2023 Posted October 22, 2023 Works with AD 1.10.6 using Windows. I don't have v.2 to look at. Also pastes properly into the current version of VectorStyler. Quote
MikeW Posted October 22, 2023 Posted October 22, 2023 Ah. I only tried pasting into an existing document. Sorry. Should have read the thread better. Quote
Peter Panino Posted October 22, 2023 Author Posted October 22, 2023 The logic could be so simple: If there is text in the clipboard: Check whether the text is an SVG XML. If yes, create a new SVG Designer tab and insert the SVG. If there is a file in the clipboard, check if it is an SVG file. If yes, create a new SVG Designer tab and insert the SVG. I could implement this in less than 30 minutes. Quote
v_kyr Posted October 22, 2023 Posted October 22, 2023 7 hours ago, Peter Panino said: Unfortunately, that does not work on Designer 2.2.1 for Windows: https://app.screencast.com/D1ZS3UvQCAbhN Seems to be an ADe 2.1.1 under Win problem, as under macOS and even ADe v1 it works as expected ... screencast_mac.mp4 Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
Peter Panino Posted October 23, 2023 Author Posted October 23, 2023 Reference for the Microsoft Clipboard API: https://learn.microsoft.com/en-us/dotnet/api/system.windows.clipboard?view=windowsdesktop-7.0 It is straightforward to handle. There are also examples. Quote
Dan C Posted October 23, 2023 Posted October 23, 2023 Thanks for your report @Peter Panino! I'm not entirely certain of the exact reasoning behind this currently, though I can see that Affinity macOS is able to create a New from Clipboard document using SVG data, so I would expect Affinity Windows to also support this. I have therefore logged this as a bug with our development team for you now. I hope this helps Peter Panino 1 Quote
v_kyr Posted October 23, 2023 Posted October 23, 2023 1 hour ago, lacerto said: ... It requires a specific data stream tagged as containing SVG ... The by Win defined and recognized mime type for SVG here is usually "image/svg+xml" ... string svg = GetSvg(); byte[] bytes = Encoding.UTF8.GetBytes(svg); MemorySteam stream = new MemoryStream(bytes); Clipboard.SetData("image/svg+xml", stream); Also see the Remarks -> Notes on the Clipboard class. Quote An object must be serializable for it to be put on the Clipboard. If you pass a non-serializable object to a Clipboard method, the method will fail without throwing an exception. See System.Runtime.Serialization for more information on serialization. If your target application requires a very specific data format, the headers added to the data in the serialization process may prevent the application from recognizing your data. To preserve your data format, add your data as a Byte array to a MemoryStream and pass the MemoryStream to the SetData method. Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
v_kyr Posted October 23, 2023 Posted October 23, 2023 30 minutes ago, lacerto said: ... but if I add the suggested stream tag on Clipboard, Affinity apps cease to recognize SVG code on Clipboard and can no longer render items on canvas of an existing document. If I use image/x-inkscape-svg, this works in all apps at some level ... That's an external Inkscape defined mime type (aka Inkscape SVG flavor specific) and not the common used SVG one. https://www.w3.org/TR/SVG/mimereg.html https://www.digipres.org/formats/mime-types/ https://www.iana.org/assignments/media-types/media-types.xhtml Common mime types 1 hour ago, lacerto said: IMO there is no "glitch" or omission on Windows versions of Affinity apps. As mentioned, macOS seems to encapsulate text (including SVG code) -- in addition to placing it in multiple text formats -- within an .RTF block and thus wraps the code within a document format supported ty Affinity apps. I think there is, as it otherwise would work for correctly defines SVG code -as shown above in the initial post- as expected. And in the simplest turnaround case, it could create there then a temporary SVG file (tmp.svg) from the clipboard UTF-8 text contents and open that. Beside that Windows also supports RTF (richtext) handling, so a document format which is supported by Affinity apps. Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.