Inkscape.org
Beginners' Questions How to create links to a portion of a text?
  1. #1
    Marco Alici Marco Alici @MarcoA

    Hi,
    I'd like to write a text box and to add a link to a website just to a portion of it, not the whole textbox. Is it possible?

    I can only link the whole textbox, while I'd like to link just a word, or to link different words to different websites.

    Can you help me, please?

     

    Cheers,

    MarcoA

  2. #2
    Polygon Polygon @Polygon🌶

    Same here - maybe make the word you want to use as a link its own Text object.

  3. #3
    inklinea inklinea @inklinea⛰️

    It can be done, but it's a bit fiddly.

    You have to force Inkscape to create a Tspan.
    If you select some text with a word and change something.
    For example the colour, or change the opactity from 100 to 99 (you can change it back later)
    Go into the XML Editor, and expand the relevant text element and click that tspan.
    The bounding box of the text you have changed should be highlighted on canvas.

    That will make the tspans appear for that text element in the objects and layers panel.

    Left click the correct tspan (usually the tree will show <text><tspan><tspan></tspan></tspan>)

    Make sure the bounding box is highlighted on canvas then right click and choose Create anchor (hyperlink)

    Add the link in the Href box.

    If you want the link to open in another tab add _blank (underscore required) in the Target box

    If you make any alterations, make sure you right click the newly created anchor object and choose Link Properties not the tspan again.

    There has to be a separate tspan for each link. If have created one link in the middle of a phrase, but want two words to contain links you must repeat the process for that 2nd word / link.

    Drawing
    Screenshot From 2023 02 05 13 52 39
    Screenshot From 2023 02 05 13 51 49
  4. #4
    Marco Alici Marco Alici @MarcoA

    Hi,

    thank you very much for your reply!

    inklinea

    Left click the correct tspan (usually the tree will show <text><tspan><tspan></tspan></tspan>) Make sure the bounding box is highlighted on canvas then right click and choose Create anchor (hyperlink)

    I tried step by step: I can select the tspan (the bounding box is highlighted) but when I right click on it, the selection pass to the whole textbox and it seems impossible to create the hyperlink on the tspan alone.

    I also tried to manually add "xlink:href" property to the tspan, but it doesn't seem to work.

     

  5. #5
    inklinea inklinea @inklinea⛰️

    You save as the 'Inkscape Gimp Scribus' svg in the post above ? does it work in the browser for you ? 

  6. #6
    Marco Alici Marco Alici @MarcoA
    inklinea

    You save as the 'Inkscape Gimp Scribus' svg in the post above ? does it work in the browser for you ?

    I need to save it as PDF.

  7. #7
    inklinea inklinea @inklinea⛰️

    Okay, I tested it with save as PDF.

    It seems that the tspan links (which work with svg in the browser) do not survive the journey to PDF :(

    As a work around, you could do as Polygon suggests and make separate text elements.

    However since PDF does embed fonts, so any text is the same size as that text being converted to paths. ( which is not true for svg if the font is not installed on the target system ).

    You could: Edit>Copy the entire text object.

    Then Edit>Paste in Place

    Path>Object to Path

    On the resulting letter group Object>Ungroup

    Delete the path object letters you don't want any more.

    Select the remaining path letter objects then Object>Group

    Add the link to that group - then export.

     

Inkscape Inkscape.org Inkscape Forum Beginners' Questions How to create links to a portion of a text?