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

  • Home
  • SEARCH
  • 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 6383741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:41:15+00:00 2026-05-25T02:41:15+00:00

I’ve created and SVG-file from an Illustrator-image. I’m using this: https://github.com/wout/raphael-svg-import to import and

  • 0

I’ve created and SVG-file from an Illustrator-image. I’m using this: https://github.com/wout/raphael-svg-import to import and display the vector-image.

I read the svg-file in as text, and submit it to the import-function:

var mygetrequest = new XMLHttpRequest();
var svgdata = mygetrequest.responseText; 
paper.importSVG(svgdata); //where paper is my Raphael canvas

All working very nicely.

But I can’t seem to find any info or hints on how to change the settings and view of the image?
For example I would very much like it to fill out its container, disregarding the size of this.

Any ideas? Documentation to help me along the way? Anything, really…

  • 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-05-25T02:41:16+00:00Added an answer on May 25, 2026 at 2:41 am

    There’s two ideas I can offer you:

    1) maybe the SVG import takes into account the original size and does scaling for you. However when editing in illustrator you might have a much bigger document around it, which confuses the svgImport?

    2) Otherwise, you could import the paper as a set. And scale the set.

    var set = paper.set();
    paper.importSVG(svgdata, set);
    set.scale( 2, 2, centerx, centery );
    

    (I’m not sure without an example to play with, what centerx and centery should be).

    [EDIT (after approval)]
    It seems Raphael enables you to get a set’s bounding box:

    var bbox = set.getBBox();
    // You'll now have bbox.x, bbox.y, bbox.width and bbox.height at your disposal. 
    // For example:
    paper.rect( bbox.x, bbox.y, bbox.width, bbox.height ).attr('border', 'red');
    

    So I’d say you could:

    1. Get bounding box of imported SVG set
    2. Use set.translate to align the bounding box’s center with the center of the paper (use something like ( paperwidth / 2 ) - ( bbox.x + bbox.width / 2 ) for example for the x translation).
    3. Scale based on the bounding box size compared to the paper size. You probably want to scale while maintaining aspect ratio so you’ll have to use the one that’s closest to 1 (of
      paper.width/bbox.width and paper.height/bbox.height).
    4. (Note: use center of paper now as center of scaling – since you translated your set this is actually the center of the svg set as well)

    I did this from the top of my head so it might not be 100% accurate, but if you get the idea you’ll probably be able to get rid of the glitches.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported

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.