Inkscape.org
Beginners' Questions Matching Viewbox to Page
  1. #1
    Learner_UK Learner_UK @Learner_UK

    Hello all,

    I have attached a sample file, to show the problem I am having.  I wanted an image 3750px wide by 2875px high, that has some text at the bottom.  The size of my page matches those dimensions and the image looks as I want it to.  But, when I try to use it on a website, I get an error, that the text lies outside the viewbox parameters.  So, I can see in Document Properties, that the viewbox starts at the top left corner (x=0, y=0, and then only extends part of the way over the page.  If I try to match the viewbox dimension to the page, then it makes my text tiny, and moves its position.  I have many images like this, so it will be a lot of work to reformat them all.  Is there a way to match the viewbox to the page, and not change anything?

    Thanks for any help!

    Text View
  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    I stumbled across a discussion recently about an extension to to this. It may take some time to find it. 

     

  3. #3
    COD COD @COD
    👍🏆

    Looks correct In Opera for Windows 11. However - your document scale is incorrect. it should be "1". This might be causing other browsers to display it wrong..

    To correct your other documents - this is going to be painful unless you do it correctly. 

    Before you change the scale to "1". Be sure you click the icon next to scale input until you see "3 dots" . Then change the scale to 1.


     

  4. #4
    Tyler Durden Tyler Durden @TylerDurden
    👍*

    Thank you @COD. I knew I had seen it recently.

    @Lerner_UK, henceforth, I'd start all new documents by selecting a "Screen" template and then setting the page size. This will have the correct scale.

     

  5. #5
    Learner_UK Learner_UK @Learner_UK

    Ah, I see what you mean about the scale. Actually I don't have the 3 dots on my Windows 10, but that doesn't seem to matter.  I think the solution for me is to manually match the width & height of the Viewbox, and then use the scaling that I currently have, which is 3.779528.  When I put that back in after adjusting the size of the viewbox, I get the results I want.

    Next time I'll be sure the scaling is correct before I start drawing.  I think my manual rescaling, and changing of the page size over time, has resulted in the discrepancy between page & viewbox.

    Thanks a lot for the help!

  6. #6
    COD COD @COD

    Yes - this is a recent change. v1.3 or 1.4? It was added to prevent rescaling everything in the document if you change the document scale. That icon needs to be changed though. Hard for the user to understand what is happening. Might send a few to the emergency room if they forget about "undo". 🤣

  7. #7
    Tyler Durden Tyler Durden @TylerDurden
    👍

    Clicking the button will toggle the indicator between three dots and one dot.

    Actually the icon looks like this if enlarged.

    This issue has been seen before. Usually due to a rogue template that had mm as the units and scale of 1. 

  8. #8
    Tyler Durden Tyler Durden @TylerDurden
    *

    IMO, It would be better if the scaling tools were hidden in an expandable advanced settings area.

    Yes, this appeared in the 1.4 release notes.

     

    For my failing memory: #scale #document #rescale 

  9. #9
    COD COD @COD

    Tyler - 
    I have noticed that during a session - that if you play around with different document units (not measurment units) - that the document scaling will become corrupt once you finally decide on what you want. Been wanting to report this but I can't replicate the bug with any consistency.

    Once I decide what I want - I check it by switching to px units and verify the scale is one - then switch it back to the unit I want. 

  10. #10
    COD COD @COD

    Tyler - I agree - that should be an advanced setting for geeks and nerds to play with. The average users doesn't need that. For "makers/crafters" - that is an even more confusing setting because "scale" doesn't mean what we think it means. It is a conversion factor between pixel units and mm,cm, inch etc. 

  11. #11
    Tyler Durden Tyler Durden @TylerDurden
    COD

    the document scaling will become corrupt once you finally decide on what you want

    That sounds bad.  I easily imagine it happening though, the UU factors can be many digits to the right of the decimal point and rounding error is a possibility. For some time, the scale was expressed as the inverse of the current, so the scale factors were usually greater than 1, rather than a decimal portion of 1.

  12. #12
    Learner_UK Learner_UK @Learner_UK
    👍

    I just realised that doing what I suggested, doesn't actually make any difference, because after resizing the viewbox, and pasting back in the scale, it changes the viewbox back to what it was before.  Strangely, in spite of this, it seemed to make the files viewable in VS Code, which wasn't happening before.

    Anyway, I have upgraded to the latest version, done exactly what @COD suggested , and all is well in the world!

    Thanks again!

  13. #13
    COD COD @COD

    Oh - you use VS Code. I only started using that the last few months. Mainly to do mass find/replace on some of my older Inkscape documents. 

    I have tried avoid going into the weeds with Inkscape but no choice. Is there a way to get VS Code to do XSLT 2.0 transforms? It is my understanding that it will only do XSLT 1.0 transforms.  

  14. #14
    Learner_UK Learner_UK @Learner_UK

    Sorry I don't know about that.  I am also quite new to VS Code, after finding a great instructional on YouTube, to learn HTML/CSS/JS.  I am building a website.  But I have now discovered claude.ai which is an amazing tool for creating code.  It doesn't hurt to have some previous coding experience though.  You should ask clause.ai the same question, and you'll probably get a good answer.  It's free to start with, but you're only allowed a small amount of usage per day.

  15. #15
    COD COD @COD

    That's ok. Interesting you are using AI. I discovered that  AI I use (CoPilot) spits out usable XSLT 2.0 code. Unfortunately, VS doesn't do 2.0. 😭