Jump to content
You must now use your email address to sign in [click for more info] ×

Recommended Posts

I want to import/place the following SVG file (hlines.svg).  It looks correct in Illustrator.  I can also open the file in Chrome and it looks correct.

 

AI.thumb.png.8beaab6d3196d464a9d7eb1f7dc1a94c.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Here is how it looks when imported/placed in Designer:

It is faint, but only the square in the upper left corner appears and it is missing the two horizontal black bars.  How do I fix this?

 

AD.thumb.png.664beb631bd43b6e8ae49b0cf23d9753.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If I open the file it looks similar but I get a long list of layers.  It seems that all of the boxes are being stacked on top of each other.  I can select a layer and then move the SVG object to a different location.  In this example, I moved each of the boxes from the upper left corner, where they were stacked on top of each other.

 

I don't care if the objects are on separate layers or flattened on the same layer.  I am not doing any editing except for scaling the entire image to 30 in x 30 in.  I just need it to look like the image at the top,

 

layers.thumb.png.a8969bf1c8736e6c263f8c067a9f32c7.png

hLines.svg

Edited by Poetic Gibberish
Provided additional information
Link to comment
Share on other sites

Well your initial SVG code is differently parsed and interpreted by AD here, meaning that it doesn't take for those nested SVG elements their positions (x="n" y="n") into account and thus all the layers are laying one above the other at x="0" y="0" here.

So you have to either recode the SVG text file manually (via an editor) or reposition the layers inside of AD and then export as SVG, in order to see how AD would handle and generate the SVG code instead!

Here below is a SVG file that AD should be able to handle.

ad_hLines.svg

 

☛ 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

Link to comment
Share on other sites

Then AD is of no help for you here, since it has still problems with importing/parsing some SVG elements other tools (like Webbrowsers or Inkscape etc.) don't have here.

☛ 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

Link to comment
Share on other sites

MEB,

Thank you for the reply and confirming this is a software bug.  I am using the evaluation software, so my trial period is going to run out before there is a fix available.  Is there some way I could get notified when a fix is available and then get another trial period to test it?  I really want to switch from Illustrator to Designer, but having SVG render correctly is essential.

 

Thanks,

Erik

Link to comment
Share on other sites

  • 3 months later...

I just stumbled over the same problem. I generate SVG based on database entries for scientific purposes. Afterwards I'd like to clean and beautify them for scientific publications in AD.

As my SVG are made by for-loop in python, it is much easy to nest SVG than group and transform them.

I have attached a typical SVG to this post.

 

All my Browsers and Inkscape opens them as itended but, AD just puts all SVG containers on top of each other - annoying.


Is there any news, on when or if it will be fixed?

 

Best,

Jan

 

A.svg

Link to comment
Share on other sites

I pretty much doubt that a browser shows up anything useful here since first of all there aren't any associated style information supplied in the generated SVG code. - The code misses an associated style info like ...

<svg xmlns="http://www.w3.org/2000/svg">
  ...
</svg>

Next the SVG code is pretty dump generated, all as pretty much the same nested SVG calls, which differ just in the nested SVG y direction by increasing 6mm...

 

<svg>
<svg y="0mm" width="210mm" height="5mm" viewboxport="0 0 210 5">
<line x1="20.0mm" y1="2.5mm" x2="160.5mm" y2="2.5mm" stroke="black" stroke-width="1"/>
<rect x="89.0mm" y="0.5mm" width="64.5mm" height="4mm" fill="#0070a0"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="white" x="121.25mm" y="3.7mm" text-anchor="middle">43</text>
<rect x="66.0mm" y="0.5mm" width="15.0mm" height="4mm" fill="#f23137"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="white" x="73.5mm" y="3.7mm" text-anchor="middle">10</text>
<rect x="86.0mm" y="0.5mm" rx="2" ry="2" width="2.0mm" height="4mm" fill="#ffe03f"/>
<rect x="155.0mm" y="0.5mm" rx="2" ry="2" width="1.5mm" height="4mm" fill="#ffe03f"/>
<rect x="60.5mm" y="0.5mm" rx="2" ry="2" width="4.5mm" height="4mm" fill="#ffe03f"/>
<rect x="20.0mm" y="0.5mm" width="14.5mm" height="4mm" fill="#70c1b3"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="black" x="0mm" y="3.7mm" text-anchor="left">COL104 (A)</text>
</svg>
<svg y="6mm" width="210mm" height="5mm" viewboxport="0 0 210 5">
<line x1="20.0mm" y1="2.5mm" x2="160.5mm" y2="2.5mm" stroke="black" stroke-width="1"/>
<rect x="89.0mm" y="0.5mm" width="64.5mm" height="4mm" fill="#0070a0"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="white" x="121.25mm" y="3.7mm" text-anchor="middle">43</text>
<rect x="66.0mm" y="0.5mm" width="15.0mm" height="4mm" fill="#f23137"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="white" x="73.5mm" y="3.7mm" text-anchor="middle">10</text>
<rect x="86.0mm" y="0.5mm" rx="2" ry="2" width="2.0mm" height="4mm" fill="#ffe03f"/>
<rect x="155.0mm" y="0.5mm" rx="2" ry="2" width="1.5mm" height="4mm" fill="#ffe03f"/>
<rect x="60.5mm" y="0.5mm" rx="2" ry="2" width="4.5mm" height="4mm" fill="#ffe03f"/>
<rect x="20.0mm" y="0.5mm" width="14.5mm" height="4mm" fill="#70c1b3"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="black" x="0mm" y="3.7mm" text-anchor="left">COL104 (A1)</text>
</svg>
<svg y="12mm" width="210mm" height="5mm" viewboxport="0 0 210 5">
<line x1="20.0mm" y1="2.5mm" x2="156.5mm" y2="2.5mm" stroke="black" stroke-width="1"/>
<rect x="88.0mm" y="0.5mm" width="61.5mm" height="4mm" fill="#0070a0"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="white" x="118.75mm" y="3.7mm" text-anchor="middle">41</text>
<rect x="151.0mm" y="0.5mm" rx="2" ry="2" width="1.5mm" height="4mm" fill="#ffe03f"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="black" x="0mm" y="3.7mm" text-anchor="left">COL182 (A2)</text>
</svg>
<svg y="18mm" width="210mm" height="5mm" viewboxport="0 0 210 5">
<line x1="20.0mm" y1="2.5mm" x2="163.5mm" y2="2.5mm" stroke="black" stroke-width="1"/>
<rect x="92.5mm" y="0.5mm" width="55.5mm" height="4mm" fill="#0070a0"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="white" x="120.25mm" y="3.7mm" text-anchor="middle">37</text>
<rect x="69.5mm" y="0.5mm" width="15.0mm" height="4mm" fill="#f23137"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="white" x="77.0mm" y="3.7mm" text-anchor="middle">10</text>
<rect x="89.5mm" y="0.5mm" rx="2" ry="2" width="2.0mm" height="4mm" fill="#ffe03f"/>
<rect x="158.5mm" y="0.5mm" rx="2" ry="2" width="1.5mm" height="4mm" fill="#ffe03f"/>
<rect x="63.5mm" y="0.5mm" rx="2" ry="2" width="5.0mm" height="4mm" fill="#ffe03f"/>
<rect x="20.0mm" y="0.5mm" width="9.5mm" height="4mm" fill="#70c1b3"/>
<text font-size="10pt" font-family="Arial, Sans-Serif" fill="black" x="0mm" y="3.7mm" text-anchor="left">COL38 (A3)</text>
</svg>
</svg>

 

... if you have as you said (via Python) control over the way the SVG code is written, then you can do probably a better job than the above shown to output SVG code which the AD parser can overall handle better here.

 

☛ 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

Link to comment
Share on other sites

Dear v_kyr,

 

thanks for analysing my crude SVG code mercilessly. You are totally right that it is badly written!

 

Unfortunately you are totally beside the point.

First of all, as an internal image, all browser show above image nicely. Even Inkscape can display it correctly and as I mentioned it is not meant to be for eternity.

Secondly, even If supply the file format it an appropriate way (actually by exporting it through inkscape) AD can still not display it correctly.

Thirdly, I specifically asked for a progress of the "bug fix" (or feature request) for the not implemented feature of svg (nested svgs with X and Y positions) mentioned in the original post, acknowledged by MEB.

 

On the later I don't think you can give me answer, but I am somehow sure you still will...

 

Best,

Jan

 

 

A.svg

Link to comment
Share on other sites

AFAI can tell the AD SVG parser can't correctly parse nested SVGs that way, similar as it can't a bunch of other SVG spec related things here. - So it's overall still far away from the robustness and capabilities of common webbrowser related SVG parsers.

Since you initially wrote ...

Quote

...Afterwards I'd like to clean and beautify them for scientific publications in AD...

... I suggested to change the generated Python SVG output, so this can be reused at all by AD yet in some better working manner, as far as reusability in AD is mandatory for you and as far as you have finer control over the Python output generation here. - Related to the AD parsing bug fixes etc. only the AD dev team can tell you how their roadmap looks like according to this.

☛ 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

Link to comment
Share on other sites

  • 7 months later...

Is AD's SVG parser unable to properly interpret transforms?

This very simple SVG is showing properly in Chrome, Internet Explorer, and PowerPoint, but in AD, the path is incorrectly positioned so part of it is outside the viewbox:

<svg width="27.1" height="27.2" viewBox="-13.5, -13.5, 27.1, 27.2" 
    xmlns="http://www.w3.org/2000/svg" version="1.1">
    <path
        d="M0,-440 L0,-420 A420,420 0 0 1 14.7,-419.7 L15.4,-439.8 A440,440 0 0 0 0,-440 z"
        transform="translate(-7.5, 429.9) rotate(44, 7.5,-429.9)"
        stroke-width="1"
        stroke-linejoin="round"
        stroke="red"
        fill="red">
    </path>
</svg>

What it's supposed to look like:

image.png.70c02203a367e5483dfe1ae5c25a7956.png

What it looks like in AD:

image.png.e645b7e814c1135834b6659e21f8c588.png 

If I edit in AD, I get this:

image.png.7e67d30f1a57378e471a84c86e4e2699.png

 

It would be nice to know if Affinity has plans to fix this.

Link to comment
Share on other sites

Just curious, what was the SVG created in?

iMac 27" 2019 Somona 14.3.1, iMac 27" Affinity Designer, Photo & Publisher V1 & V2, Adobe, Inkscape, Vectorstyler, Blender, C4D, Sketchup + more... XP-Pen Artist-22E, - iPad Pro 12.9  
B| (Please refrain from licking the screen while using this forum)

Affinity Help - Affinity Desktop Tutorials - Feedback - FAQ - most asked questions

Link to comment
Share on other sites

46 minutes ago, Dan_M said:

It was generated from a web application I wrote.

Thanks, makes me wonder how devs decide on the SVG code to use for export considering the variations that appear to be about. I would have thought the simpler the better, bear in mind I'm not a coder, I dabble and understand it but that's as far as it goes.

iMac 27" 2019 Somona 14.3.1, iMac 27" Affinity Designer, Photo & Publisher V1 & V2, Adobe, Inkscape, Vectorstyler, Blender, C4D, Sketchup + more... XP-Pen Artist-22E, - iPad Pro 12.9  
B| (Please refrain from licking the screen while using this forum)

Affinity Help - Affinity Desktop Tutorials - Feedback - FAQ - most asked questions

Link to comment
Share on other sites

11 hours ago, firstdefence said:

Thanks, makes me wonder how devs decide on the SVG code to use for export considering the variations that appear to be about. I would have thought the simpler the better, bear in mind I'm not a coder, I dabble and understand it but that's as far as it goes.

SVG is pretty standardized. You do have some choices in how you do styling and positioning, though. When it comes to positioning, transforms are a way to let the renderer handle the geometry calculations. For example, it's easier to draw an upright rectangle and rotate it 28 degrees than determine the coordinates of the four points of a rectangle after it has been rotated.

Link to comment
Share on other sites

6 hours ago, Paul Jacobson said:

Dan_M,

Turn off  "Clip to Canvas"

https://affinity.help/designer/en-US.lproj/index.html?page=pages/DesignAids/clipToCanvas.html?title=Clip%20to%20Canvas

That will show the parts that bleed off the canvas.

Thanks for the tip, but unfortunately it doesn't seem to apply to embedded objects. They still get clipped by their own local canvas.

Link to comment
Share on other sites

10 hours ago, Medical Officer Bones said:

Open troublesome SVG files in the Opera browser, right-mouse click the SVG, and save as PDF. Then open the PDF in Affinity.

Thanks for the idea, but I don't have Opera, and if I try "print to PDF" using Chrome, it does not work.

Link to comment
Share on other sites

There are actually two problems when embedding SVGs.

1. As already mentioned, transforms don't seem to work reliably, resulting in problems like the image being positioned incorrectly within the clipping region/view box.

2. The embeded SVG is rendered at 72 DPI even though my Document Setup specifies 96 DPI. (On Windows, 96 DPI is the standard.)

One workaround I tried was to convert the SVG to a PNG before embedding. This helps with problem #1 but not problem #2. It also will pixelate if I decide to enlarge it later or print it.

A second workaround I tried was to (1) edit the embedded SVG within AD, (2) copy all the parts, (3) exit the editor, (4) paste the parts onto the main canvas, and (5) delete the original. This solves (1) and (2), however, it still results in things being positioned incorrectly if there are transforms.

One thing I'd like to try is opening the SVGs in Illustrator and saving them in illustrator format, then embedding them in AD. I will report back if that works.

Anyway, I don't know if anyone from Affinity is following this thread, but I hope this will be fixed. I was very excited about this software until I hit this issue. SVGs are pretty popular among web designers these days, so I'm a little surprised it hasn't been a higher priority to fix this.

Link to comment
Share on other sites

5 minutes ago, Medical Officer Bones said:

Well, the Opera browser is a free and safe browser. I use it quite regularly to convert SVG files to PDF (not so much for browsing, funnily enough).

I'm sure Opera is great, but it looks as though https://cloudconvert.com/svg-to-pdf might be the right tool for the job. I just tried converting one of my troublesome SVGs to a PDF and dragged it into my AD canvas. Worked well. I'd rather not have to go through this extra step, but it'll do for now.

Link to comment
Share on other sites

5 hours ago, Dan_M said:

I'm sure Opera is great, but it looks as though https://cloudconvert.com/svg-to-pdf might be the right tool for the job. I just tried converting one of my troublesome SVGs to a PDF and dragged it into my AD canvas. Worked well. I'd rather not have to go through this extra step, but it'll do for now.

Sure, whatever works. I prefer Opera since it is installed on my local machine, and I can't be uploading licensed (client) work to an online service like that. I need to be able to maintain control over the files.

Link to comment
Share on other sites

On 10/17/2018 at 1:16 PM, Dan_M said:

SVG is pretty standardized.

Regarding that, you may find https://www.adobe.com/devnet/svg/articles/svg-jon-ferraiolo-interview.html of interest, in particular the explanation for why the SVG spec is so enormous & includes so many different ways of implementing features.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.