Jump to content

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

Share this post


Link to post
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.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

I appreciate the explanation.  Unfortunately, the most efficient solution for me is going to be Illustrator since it imports with no issues there.  I have too many SVG files all formatted the same way to do any kind of manual fix.

Share this post


Link to post
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.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share this post


Link to post
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

Share this post


Link to post
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.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Just curious, what was the SVG created in?


iMac 27" Late 2015 Fully Loaded, iMac 27" Mid 2011 both running High Sierra 10.13.6 - Affinity Designer/Photo, Publisher Beta 1.7.0.140, Illustrator CC, Inkscape, Blender, Sketchup, Pepakura Designer, MTC, Pixelmator & Pixelmator Pro + more... XP-Pen Artist-22E, - iPad Pro 12.9 B|  

Affinity Help - Affinity Desktop Tutorials Instagram & Flickr - Affinity Live 19th June 2019

Share this post


Link to post
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" Late 2015 Fully Loaded, iMac 27" Mid 2011 both running High Sierra 10.13.6 - Affinity Designer/Photo, Publisher Beta 1.7.0.140, Illustrator CC, Inkscape, Blender, Sketchup, Pepakura Designer, MTC, Pixelmator & Pixelmator Pro + more... XP-Pen Artist-22E, - iPad Pro 12.9 B|  

Affinity Help - Affinity Desktop Tutorials Instagram & Flickr - Affinity Live 19th June 2019

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
32 minutes ago, Dan_M said:

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

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).

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×