• pdf output with a clickable url

    From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Fri Feb 23 17:19:37 2024
    From Newsgroup: comp.lang.tcl

    I am still with a huge rewrite of PDF output.
    The challenge of Chinese characters was already answered by tclFPDF. https://github.com/lamuzzachiodi/tclfpdf
    A 2nd challenge is to add URL links. tFPDF also has the method "Write",
    which may take a URL Link.

    So far, I use TCLPDF.
    I would love to have those two features ported to TCLPDF:
    - add the dynamic font creation for arbitrary unicode text.
    - add the possibility to add a hyerlink with a clickable URL

    But I suppose, I have to migrate my code to tFPDF.

    Or do you see any chance to unify the projects?

    Thank you and take care,
    Harald
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Christian Gollwitzer@auriocus@gmx.de to comp.lang.tcl on Fri Feb 23 21:04:33 2024
    From Newsgroup: comp.lang.tcl

    Am 23.02.24 um 17:19 schrieb Harald Oehlmann:
    I am still with a huge rewrite of PDF output.
    The challenge of Chinese characters was already answered by tclFPDF. https://github.com/lamuzzachiodi/tclfpdf
    A 2nd challenge is to add URL links. tFPDF also has the method "Write", which may take a URL Link.

    So far, I use TCLPDF.

    I suppose you mean pdf4tcl by Peter Spjuth, correct? A good while ago, I
    added PDF attachments to pdf4tcl.

    I would love to have those two features ported to TCLPDF:
       -   add the dynamic font creation for arbitrary unicode text.
       -   add the possibility to add a hyerlink with a clickable URL

    But I suppose, I have to migrate my code to tFPDF.

    Or do you see any chance to unify the projects?

    Adding links to pdf4tcl is probably relatively easy. The spec is totally
    open: https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf See under 12.5.6.5 "Link annotations", below the table you see how it
    the code would look like. Before compression, PDF is a text format with
    the characteristic << >> brackets for objects (they are like dicts).
    Such a link is not visible by itself, it is attached to some area on the
    page, where you can draw anything else to make the link clear. In
    pdf4tcl, you can use "AddObject" to add such a thing.

    The thing with the UTF-8 text seems much more complicated. I haven't
    looked into PDF recently; in the original version, each font could only
    have 256 characters and so the software split fonts into multiple
    subfonts. ISTR that for the Chinese case, there was an alternative way
    of font handling with 64k characters. If there is a way to make a PDF
    font with all characters, than you only need to port over the code for
    the font creation and can then use it. If, however, tFPDF does it as in
    the old days, creating multiple fonts and switching in the fly between
    them, then I'm afraid that would mean to replace the entire text drawing
    code. If you don't feel like looking into it yourself, maybe you can pay someone to do it ;)

    Christian
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Mon Feb 26 09:59:13 2024
    From Newsgroup: comp.lang.tcl

    Am 23.02.2024 um 21:04 schrieb Christian Gollwitzer:
    Am 23.02.24 um 17:19 schrieb Harald Oehlmann:
    I am still with a huge rewrite of PDF output.
    The challenge of Chinese characters was already answered by tclFPDF.
    https://github.com/lamuzzachiodi/tclfpdf
    A 2nd challenge is to add URL links. tFPDF also has the method
    "Write", which may take a URL Link.

    So far, I use TCLPDF.

    I suppose you mean pdf4tcl by Peter Spjuth, correct? A good while ago, I added PDF attachments to pdf4tcl.

    I would love to have those two features ported to TCLPDF:
        -   add the dynamic font creation for arbitrary unicode text.
        -   add the possibility to add a hyerlink with a clickable URL

    But I suppose, I have to migrate my code to tFPDF.

    Or do you see any chance to unify the projects?

    Adding links to pdf4tcl is probably relatively easy. The spec is totally open: https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf
    See under 12.5.6.5 "Link annotations", below the table you see how it
    the code would look like. Before compression, PDF is a text format with
    the characteristic << >> brackets for objects (they are like dicts).
    Such a link is not visible by itself, it is attached to some area on the page, where you can draw anything else to make the link clear. In
    pdf4tcl, you can use "AddObject" to add such a thing.

    The thing with the UTF-8 text seems much more complicated. I haven't
    looked into PDF recently; in the original version, each font could only
    have 256 characters and so the software split fonts into multiple
    subfonts. ISTR that for the Chinese case, there was an alternative way
    of font handling with 64k characters. If there is a way to make a PDF
    font with all characters, than you only need to port over the code for
    the font creation and can then use it. If, however, tFPDF does it as in
    the old days, creating multiple fonts and switching in the fly between
    them, then I'm afraid that would mean to replace the entire text drawing code. If you don't feel like looking into it yourself, maybe you can pay someone to do it ;)

             Christian

    Hi Christian,

    thanks for the valuable contribution and motivation !
    Take care,
    Harald
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Mon Feb 26 19:12:48 2024
    From Newsgroup: comp.lang.tcl

    Am 26.02.2024 um 09:59 schrieb Harald Oehlmann:
    Am 23.02.2024 um 21:04 schrieb Christian Gollwitzer:
    Am 23.02.24 um 17:19 schrieb Harald Oehlmann:
    I am still with a huge rewrite of PDF output.
    The challenge of Chinese characters was already answered by tclFPDF.
    https://github.com/lamuzzachiodi/tclfpdf
    A 2nd challenge is to add URL links. tFPDF also has the method
    "Write", which may take a URL Link.

    So far, I use TCLPDF.

    I suppose you mean pdf4tcl by Peter Spjuth, correct? A good while ago,
    I added PDF attachments to pdf4tcl.

    I would love to have those two features ported to TCLPDF:
        -   add the dynamic font creation for arbitrary unicode text.
        -   add the possibility to add a hyerlink with a clickable URL

    But I suppose, I have to migrate my code to tFPDF.

    Or do you see any chance to unify the projects?

    Adding links to pdf4tcl is probably relatively easy. The spec is
    totally open:
    https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf
    See under 12.5.6.5 "Link annotations", below the table you see how it
    the code would look like. Before compression, PDF is a text format
    with the characteristic << >> brackets for objects (they are like
    dicts). Such a link is not visible by itself, it is attached to some
    area on the page, where you can draw anything else to make the link
    clear. In pdf4tcl, you can use "AddObject" to add such a thing.

    The thing with the UTF-8 text seems much more complicated. I haven't
    looked into PDF recently; in the original version, each font could
    only have 256 characters and so the software split fonts into multiple
    subfonts. ISTR that for the Chinese case, there was an alternative way
    of font handling with 64k characters. If there is a way to make a PDF
    font with all characters, than you only need to port over the code for
    the font creation and can then use it. If, however, tFPDF does it as
    in the old days, creating multiple fonts and switching in the fly
    between them, then I'm afraid that would mean to replace the entire
    text drawing code. If you don't feel like looking into it yourself,
    maybe you can pay someone to do it ;)

              Christian

    Hi Christian,

    thanks for the valuable contribution and motivation !
    Take care,
    Harald

    Christian,
    I have put your valuable information to two tickets in pdf4tcl.

    Do you volunteer to be payed ;-).

    I think, my current application with only some lines of Chinese Text
    will work-out with the current possibilities.
    But it would be great, if we should just not worry.

    I also asked Jan about a list of Unicode Codepoints an encoding covers.
    He answered, that this information is available in memory when an
    encoding is loaded. That may also be helpful for the issue.
    But with TCL 9, we may check, if a certain string may be covered by a
    certain encoding.

    Thanks for all and take care,
    Harald
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Wed Feb 28 18:51:18 2024
    From Newsgroup: comp.lang.tcl

    Am 26.02.2024 um 19:12 schrieb Harald Oehlmann:
    Am 26.02.2024 um 09:59 schrieb Harald Oehlmann:
    Am 23.02.2024 um 21:04 schrieb Christian Gollwitzer:
    Am 23.02.24 um 17:19 schrieb Harald Oehlmann:
    I am still with a huge rewrite of PDF output.
    The challenge of Chinese characters was already answered by tclFPDF.
    https://github.com/lamuzzachiodi/tclfpdf
    A 2nd challenge is to add URL links. tFPDF also has the method
    "Write", which may take a URL Link.

    So far, I use TCLPDF.

    I suppose you mean pdf4tcl by Peter Spjuth, correct? A good while
    ago, I added PDF attachments to pdf4tcl.

    I would love to have those two features ported to TCLPDF:
        -   add the dynamic font creation for arbitrary unicode text. >>>>     -   add the possibility to add a hyerlink with a clickable URL >>>>
    But I suppose, I have to migrate my code to tFPDF.

    Or do you see any chance to unify the projects?

    Adding links to pdf4tcl is probably relatively easy. The spec is
    totally open:
    https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf
    See under 12.5.6.5 "Link annotations", below the table you see how it
    the code would look like. Before compression, PDF is a text format
    with the characteristic << >> brackets for objects (they are like
    dicts). Such a link is not visible by itself, it is attached to some
    area on the page, where you can draw anything else to make the link
    clear. In pdf4tcl, you can use "AddObject" to add such a thing.

    The thing with the UTF-8 text seems much more complicated. I haven't
    looked into PDF recently; in the original version, each font could
    only have 256 characters and so the software split fonts into
    multiple subfonts. ISTR that for the Chinese case, there was an
    alternative way of font handling with 64k characters. If there is a
    way to make a PDF font with all characters, than you only need to
    port over the code for the font creation and can then use it. If,
    however, tFPDF does it as in the old days, creating multiple fonts
    and switching in the fly between them, then I'm afraid that would
    mean to replace the entire text drawing code. If you don't feel like
    looking into it yourself, maybe you can pay someone to do it ;)

              Christian

    Hi Christian,

    thanks for the valuable contribution and motivation !
    Take care,
    Harald

    Christian,
    I have put your valuable information to two tickets in pdf4tcl.

    Do you volunteer to be payed ;-).

    I think, my current application with only some lines of Chinese Text
    will work-out with the current possibilities.
    But it would be great, if we should just not worry.

    I also asked Jan about a list of Unicode Codepoints an encoding covers.
    He answered, that this information is available in memory when an
    encoding is loaded. That may also be helpful for the issue.
    But with TCL 9, we may check, if a certain string may be covered by a certain encoding.

    Thanks for all and take care,
    Harald

    Thanks to Christian for the answer and motivation.
    It was not so hard to implement. A patch is in ticket https://sourceforge.net/p/pdf4tcl/tickets/15/

    Thanks for all !
    Harald
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Christian Gollwitzer@auriocus@gmx.de to comp.lang.tcl on Thu Feb 29 18:33:39 2024
    From Newsgroup: comp.lang.tcl

    Am 28.02.24 um 18:51 schrieb Harald Oehlmann:
    Thanks to Christian for the answer and motivation.
    It was not so hard to implement. A patch is in ticket https://sourceforge.net/p/pdf4tcl/tickets/15/


    That's great - I knew you could do it! Now you only have to dig into CJK fonts... :P

    Christian

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Fri Mar 1 10:45:47 2024
    From Newsgroup: comp.lang.tcl

    Am 29.02.2024 um 18:33 schrieb Christian Gollwitzer:
    Am 28.02.24 um 18:51 schrieb Harald Oehlmann:
    Thanks to Christian for the answer and motivation.
    It was not so hard to implement. A patch is in ticket
    https://sourceforge.net/p/pdf4tcl/tickets/15/


    That's great - I knew you could do it! Now you only have to dig into CJK fonts... :P

        Christian


    Thank you, Christian, I really appreciate your motivation and
    professional information, which made this possible.
    And the framework to add an anotation to a page was already there.
    I suppose, you did that.

    Tkan you so much,
    Harald
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Fri Mar 1 11:16:15 2024
    From Newsgroup: comp.lang.tcl

    Am 29.02.2024 um 18:33 schrieb Christian Gollwitzer:
    Am 28.02.24 um 18:51 schrieb Harald Oehlmann:
    Thanks to Christian for the answer and motivation.
    It was not so hard to implement. A patch is in ticket
    https://sourceforge.net/p/pdf4tcl/tickets/15/


    That's great - I knew you could do it! Now you only have to dig into CJK fonts... :P

        Christian


    Christian,

    CJK? Oh, this is complex! So much code and tables in the font handling.
    I solved the CJK issue with the present code. I count the codepoints and
    have only 60, so it is far from 256. I will add some findings to pdf4tcl tickets about additional observations.

    Here is my report announcement in the thread "pdf4tcl and Chinese
    characters"
    But now, this issue is solved using PDF4TCL as described at the very end
    of:
    https://wiki.tcl-lang.org/page/pdf4tcl

    It is quite manual and an automated process like in tclfpdf would be
    great. The pdf4tcl ticket tracked GOT 6 new tickets.


    Thank you for all,
    Harald
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Luis Alejandro Muzzachiodi@aleccp@yahoo.com to comp.lang.tcl on Fri Mar 8 20:03:11 2024
    From Newsgroup: comp.lang.tcl

    El 23/02/2024 a las 13:19, Harald Oehlmann escribió:
    I am still with a huge rewrite of PDF output.
    The challenge of Chinese characters was already answered by tclFPDF. https://github.com/lamuzzachiodi/tclfpdf
    A 2nd challenge is to add URL links. tFPDF also has the method "Write", which may take a URL Link.

    So far, I use TCLPDF.
    I would love to have those two features ported to TCLPDF:
       -   add the dynamic font creation for arbitrary unicode text.
       -   add the possibility to add a hyerlink with a clickable URL

    But I suppose, I have to migrate my code to tFPDF.

    Or do you see any chance to unify the projects?

    Thank you and take care,
    Harald

    Hello, Harald,

    with TCLFPDF you can use links to URL or to another place within the
    document.

    For Example :

    package require tclfpdf
    namespace import ::tclfpdf::*

    ;# First page
    Init
    AddPage
    ;# Add a Unicode font (uses UTF-8)
    AddFont "DejaVu" "" "DejaVuSansCondensed.ttf" 1
    SetFont "DejaVu" "" 14
    Write 5 "To find out what's cool in this example, click "
    set link [AddLink]
    SetFont "DejaVu" "U" 14;
    Write 5 "Здравствулте мир" $link
    ;# Second page
    AddPage
    SetLink $link
    Image "logo.gif" 10 12 30 0 "" "http://www.fpdf.org"
    Output "link.pdf"

    Respect to font creation, you have the makefont utility (makefont subdirectory). The second parameter is the encoding (default is cp1252). Encodings are stored in .map files (there are availables cp1258
    -Vietnamese- or cp874 -Thai- among others) but you could create your own.
    For more info you can take a look to http://www.fpdf.org/en/tutorial/tuto7.htm. This is the original doc in
    PHP (sorry, i've forgeted add this doc in TCLFPDF). However, the
    concepts and the application is the same.


    Alejandro



    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Sun Mar 10 18:37:26 2024
    From Newsgroup: comp.lang.tcl

    Am 09.03.2024 um 00:03 schrieb Luis Alejandro Muzzachiodi:
    El 23/02/2024 a las 13:19, Harald Oehlmann escribió:
    I am still with a huge rewrite of PDF output.
    The challenge of Chinese characters was already answered by tclFPDF.
    https://github.com/lamuzzachiodi/tclfpdf
    A 2nd challenge is to add URL links. tFPDF also has the method
    "Write", which may take a URL Link.

    So far, I use TCLPDF.
    I would love to have those two features ported to TCLPDF:
        -   add the dynamic font creation for arbitrary unicode text.
        -   add the possibility to add a hyerlink with a clickable URL

    But I suppose, I have to migrate my code to tFPDF.

    Or do you see any chance to unify the projects?

    Thank you and take care,
    Harald

    Hello, Harald,

    with TCLFPDF you can use links to URL or to another place within the document.

    For Example :

    package require tclfpdf
    namespace import  ::tclfpdf::*

    ;# First page
    Init
    AddPage
    ;# Add a Unicode font (uses UTF-8)
    AddFont "DejaVu" "" "DejaVuSansCondensed.ttf" 1
    SetFont "DejaVu" "" 14
    Write 5 "To find out what's cool in this example, click "
    set link [AddLink]
    SetFont "DejaVu" "U" 14;
    Write 5 "Здравствулте мир" $link
    ;# Second page
    AddPage
    SetLink $link
    Image "logo.gif" 10 12 30 0 "" "http://www.fpdf.org"
    Output "link.pdf"

    Respect to font creation, you have the makefont utility (makefont subdirectory). The second parameter is the encoding (default is cp1252). Encodings are stored in .map files (there are availables cp1258
    -Vietnamese- or cp874 -Thai- among others) but you could create your own.
    For more info you can take a look to http://www.fpdf.org/en/tutorial/tuto7.htm. This is the original doc in
    PHP (sorry, i've forgeted add this doc in TCLFPDF). However, the
    concepts and the application is the same.


    Alejandro

    Ajejandro,
    thank you for the great work, I appreciate !
    Take care,
    Harald

    --- Synchronet 3.20a-Linux NewsLink 1.114