• New release of TCLFPDF

    From lamuzzachiodi@gmail.com@21:1/5 to All on Fri Oct 7 14:09:02 2022
    I'm' glad to announce the new release of TCLFPDF.
    It's a port fully updated of PHP to TCL of FPDF, a library wroted in PHP to generate PDF files.
    Originally released in 2014, now is based in tFPDF 1.32 (http://www.fpdf.org/en/script/script92.php), a modified class of FPDF 1.82 (http://www.fpdf.org) that adds support for UTF-8.
    One of main goals is make possible to port the examples or addons of FPDF with minimal effort.
    I hope it will be useful for the tcl community.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?B?TWlndWVsIEJhw7HDs24=?=@21:1/5 to lamuzz...@gmail.com on Sat Oct 8 05:25:11 2022
    Thanks a lot. And where can we find TCLFPDF?

    On Friday, 7 October 2022 at 23:09:04 UTC+2, lamuzz...@gmail.com wrote:
    I'm' glad to announce the new release of TCLFPDF.
    It's a port fully updated of PHP to TCL of FPDF, a library wroted in PHP to generate PDF files.
    Originally released in 2014, now is based in tFPDF 1.32 (http://www.fpdf.org/en/script/script92.php), a modified class of FPDF 1.82 (http://www.fpdf.org) that adds support for UTF-8.
    One of main goals is make possible to port the examples or addons of FPDF with minimal effort.
    I hope it will be useful for the tcl community.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ashok@21:1/5 to All on Sat Oct 8 22:29:16 2022
    On 10/8/2022 5:55 PM, Miguel Bañón wrote:
    Thanks a lot. And where can we find TCLFPDF?


    https://github.com/lamuzzachiodi/tclfpdf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Obermeier@21:1/5 to All on Sat Oct 8 21:27:21 2022
    Hi Luis,

    to make it work on Linux, the retrieval of the Windows specific environment variable
    SystemRoot must be guarded. See https://github.com/lamuzzachiodi/tclfpdf/issues/1

    Paul

    Am 07.10.2022 um 23:09 schrieb lamuzz...@gmail.com:

    I'm' glad to announce the new release of TCLFPDF.
    It's a port fully updated of PHP to TCL of FPDF, a library wroted in PHP to generate PDF files.
    Originally released in 2014, now is based in tFPDF 1.32 (http://www.fpdf.org/en/script/script92.php), a modified class of FPDF 1.82 (http://www.fpdf.org) that adds support for UTF-8.
    One of main goals is make possible to port the examples or addons of FPDF with minimal effort.
    I hope it will be useful for the tcl community.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From lamuzzachiodi@gmail.com@21:1/5 to All on Sat Oct 8 17:36:37 2022
    Miguel: You're welcome!. You can find TCLFPDF where Ashok pointed.
    Ashok: Thanks, it seems i'm not so good for marketing :-)
    Paul: I get it. I dont' know about Linux, so, it's this enough or will be necessary add some path for fonts in Linux (if exists a default location) ?

    Alejandro

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ashok@21:1/5 to lamuzz...@gmail.com on Sun Oct 9 15:06:20 2022
    On 10/9/2022 6:06 AM, lamuzz...@gmail.com wrote:
    Ashok: Thanks, it seems i'm not so good for marketing :-)
    Alejandro

    A common failing among Tclers I'm afraid :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From heinrichmartin@21:1/5 to Paul Obermeier on Sun Oct 9 05:49:13 2022
    On Saturday, October 8, 2022 at 9:27:26 PM UTC+2, Paul Obermeier wrote:
    to make it work on Linux, the retrieval of the Windows specific environment variable
    SystemRoot must be guarded. See https://github.com/lamuzzachiodi/tclfpdf/issues/1

    While looking at that code, I stumbled upon

    variable TCLFPDF_FONTPATH "[file join [pwd] [file dirname [info script]]]/font"

    and a few other occurrences of file join + pwd + info script. I wondered

    * Is info script not guaranteed to return an absolute path (while it was not overwritten with info script newpath)?
    * Is one of these patterns preferable: [file join [pwd] $path1 $path2 ...] vs [file normalize [file join $path1 $path2 ...]]?

    # untested
    variable TCLFPDF_BASEPATH [file normalize [file dirname [info script]]] variable TCLFPDF_FONTPATH [file join $TCLFPDF_BASEPATH font]

    In the end, this will most likely be a matter of taste with no real performance or maintainability impact - but it has caught my eyes.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to heinrichmartin on Sun Oct 9 13:35:11 2022
    heinrichmartin <martin.heinrich@frequentis.com> wrote:
    On Saturday, October 8, 2022 at 9:27:26 PM UTC+2, Paul Obermeier wrote:
    to make it work on Linux, the retrieval of the Windows specific
    environment variable SystemRoot must be guarded. See
    https://github.com/lamuzzachiodi/tclfpdf/issues/1

    While looking at that code, I stumbled upon

    variable TCLFPDF_FONTPATH "[file join [pwd] [file dirname [info script]]]/font"

    and a few other occurrences of file join + pwd + info script. I wondered

    * Is info script not guaranteed to return an absolute path (while it
    was not overwritten with info script newpath)?

    man n info:

    info script ?filename?
    If a Tcl script file is currently being evaluated (i.e.
    there is a call to Tcl_EvalFile active or there is an active
    invocation of the source command), then this command returns
    the name of the innermost file being processed. If filename
    is specified, then the return value of this command will be
    modified for the duration of the active invocation to return
    that name. This is useful in virtual file system
    applications. Otherwise the command returns an empty string.

    It is defined as "the name of the innermost file". Some quick testing
    with 8.6.11 on linux appears to indicate that what gets returned is the
    literal string given to whichever libc exec() call launched the script:

    Test file, sitting at /tmp/info-script:

    #!/usr/bin/tclsh

    puts "info script = [info script]"

    Current directory not /tmp:
    $ /tmp/info-script
    info script = /tmp/info-script

    Make current directory be /tmp:
    $ cd /tmp/
    $ ./info-script
    info script = ./info-script

    Try a really weird, but valid, path to the file:
    $ /tmp/../tmp/../tmp/info-script
    info script = /tmp/../tmp/../tmp/info-script

    * Is one of these patterns preferable: [file join [pwd] $path1 $path2
    ...] vs [file normalize [file join $path1 $path2 ...]]?

    File normalize and file join are two different operators, with
    different meanings. File join just joins path pieces together to create
    a single string without trying to remove any relative references or
    links that might exist along that final path (i.e., my
    /tmp/../tmp/../tmp example above). It does ignore multiple absolute references, using only the last absolute one found:

    $ rlwrap tclsh
    % file join tmp .. tmp .. tmp .. tmp
    tmp/../tmp/../tmp/../tmp
    % file join /tmp /xyz /pdq
    /pdq

    Note just literally "joined" if relative, but only last absolute is
    used.

    File normalize also does not 'join' anything, it expects to get a
    single fully 'joined' path string. It defined task is then to convert
    that path into a filesystem unique name by removing relative
    references:

    % file normalize [file join tmp .. tmp .. tmp .. tmp]
    /tmp


    # untested
    variable TCLFPDF_BASEPATH [file normalize [file dirname [info script]]] variable TCLFPDF_FONTPATH [file join $TCLFPDF_BASEPATH font]

    In the end, this will most likely be a matter of taste with no real performance or maintainability impact - but it has caught my eyes.

    Not really, the original code can return some ugly looking path strings
    if called with a relative path. It still 'works' but resolving the
    extra relative steps might be a bit of a performance hit:

    $ cat /tmp/fpdf
    #!/usr/bin/tclsh

    puts "[file join [pwd] [file dirname [info script]]]/font"

    pwd in a different directory, with an absolute path call, the [pwd] is pointless because it is never used:

    $ cd /var/log/
    $ /tmp/fpdf
    /tmp/font

    pwd in a different directory, with a relative path call:

    $ cd /var/log
    $ ./../../tmp/fpdf
    /var/log/./../../tmp/font

    We get six path lookups per access instead of just one, but we do
    find the correct location. Whether six extra lookup is noticable
    depends on the performance of the underlying filesystem/hardware.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From lamuzzachiodi@gmail.com@21:1/5 to All on Sun Oct 9 07:19:44 2022
    El domingo, 9 de octubre de 2022 a la(s) 10:35:16 UTC-3, Rich escribió:

    heinrichmartin/Rich, thanks for comments and analisys.
    As you have well noticed, the code is far from being optimal and "universal". It was tested (and is working) on Windows, both scripts and exe files.
    Therefore, any suggestion to improve the package is always welcome.

    Alejandro

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From clt.to.davebr@dfgh.net@21:1/5 to All on Sun Oct 9 14:43:14 2022
    From: Ashok <apnmbx-public@yahoo.com>
    Date: Sun Oct 09 09:36:20 GMT 2022
    Subject: New release of TCLFPDF


    This looks a similar to the pdf4tcl package. Both appear to allow Tcl to generate .pdf files.

    Dave B

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From lamuzzachiodi@gmail.com@21:1/5 to All on Sun Oct 9 09:30:31 2022
    This looks a similar to the pdf4tcl package. Both appear to allow Tcl to generate .pdf files.
    Dave B

    That's rigth. In fact, the parse of jpg files is based in pdf4tcl 0.8 (in the original PHP was used an internal function, not portable).
    Originally (many years ago), i've need to port code from PHP to TCL, this way i've started this project.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From saitology9@21:1/5 to lamuzz...@gmail.com on Tue Oct 11 12:31:50 2022
    On 10/7/22 5:09 PM, lamuzz...@gmail.com wrote:

    I'm' glad to announce the new release of TCLFPDF.
    It's a port fully updated of PHP to TCL of FPDF, a library wroted in PHP to generate PDF files.
    Originally released in 2014, now is based in tFPDF 1.32 (http://www.fpdf.org/en/script/script92.php), a modified class of FPDF 1.82 (http://www.fpdf.org) that adds support for UTF-8.
    One of main goals is make possible to port the examples or addons of FPDF with minimal effort.
    I hope it will be useful for the tcl community.

    Is this a binary package?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From lamuzzachiodi@gmail.com@21:1/5 to All on Tue Oct 11 14:37:58 2022
    Is this a binary package?
    No, it's pure TCL with no dependencies.
    (I know is not the same but i used it in tclkits exes)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From saitology9@21:1/5 to lamuzz...@gmail.com on Tue Oct 11 19:50:57 2022
    On 10/11/22 5:37 PM, lamuzz...@gmail.com wrote:
    Is this a binary package?
    No, it's pure TCL with no dependencies.
    (I know is not the same but i used it in tclkits exes)


    Nice work!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?B?TWlndWVsIEJhw7HDs24=?=@21:1/5 to lamuzz...@gmail.com on Wed Oct 12 00:22:15 2022
    What would be the advantage/difference with respect to pdf4tcl?

    On Sunday, 9 October 2022 at 18:30:34 UTC+2, lamuzz...@gmail.com wrote:
    This looks a similar to the pdf4tcl package. Both appear to allow Tcl to generate .pdf files.
    Dave B
    That's rigth. In fact, the parse of jpg files is based in pdf4tcl 0.8 (in the original PHP was used an internal function, not portable).
    Originally (many years ago), i've need to port code from PHP to TCL, this way i've started this project.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From lamuzzachiodi@gmail.com@21:1/5 to All on Wed Oct 12 14:24:52 2022
    El miércoles, 12 de octubre de 2022 a la(s) 04:22:17 UTC-3, Miguel Bañón escribió:
    What would be the advantage/difference with respect to pdf4tcl?

    I suppose that the most valid opinion would come from someone who has used both libraries, which is very unlikely.
    To TCLFPDF's credit, I can assure you that I've put a lot of work into minimizing bugs.
    As a criticism, that the code is a "translation" not an adaptation, and therefore it is not as optimized as it should be.
    Saludos,

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)