Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7778557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:25:41+00:00 2026-06-01T18:25:41+00:00

I get an XML or JSON with paths only, and I need to recreate

  • 0

I get an XML or JSON with paths only, and I need to recreate the SVG image.

I create an empty

<svg xmlns='http://www.w3.org/2000/svg' version='1.1'></svg>,

I add a <g transform="scale(1 -1)" fill='#aaa' stroke='black' stroke-width='5' ></g> in it, and then in this element I add all of the paths in it (e.g. <path d= … />).

In the end I get a SVG image, but because I haven’t set the viewBox attribute in the SVG element the image isn’t properly displayed – when I open it in browser, a part of it is displayed full size.

Can the viewBox be calculated from the values from the paths?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T18:25:42+00:00Added an answer on June 1, 2026 at 6:25 pm

    OK so I solved it the following way:

    1. removed all letters from the paths string and made an array out of it with

      var values = pathValue.split('L').join(' ').split('M').join(' ').split('z').join('').split(' ');

    2. found max and min from those values:

      var max = Math.max.apply( Math, values );

      var min = Math.min.apply( Math, values );

    3. set the viewBox:

      viewBox = max min max max

    This worked in my case excellent. Hope that it will be helpful to someone else too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created this example here... http://jsfiddle.net/rhvbG/5/ var buttons=[ '<svg version=1.1 id=Layer_1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink x=0px
I get an XML string from a certain source. I create a DOMDocument object
I need to get the xml path opf the xml file by providing the
following the instructions here http://wiki.apache.org/couchdb/ExternalProcesses this is what I get { * error: {{badarg,[{erlang,port_command,
In the android app I get an xml or json string returned, However, I
I'm working with XML data from an application where we get XML like this:
I have a few windwos services. They get xml column from Sql server manipulate
I am calling oracle package, to get xml file from the package into oracleDataReader.
I get an XML file From a web service. Now I want to get
How to get the XML translation to HTML dropdownlist with ajax? I send the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.