TCLFPDF


TCLFPDF, by LAM, is a port of tFPDF("http://www.fpdf.org/en/script/script92.php ") (1.33) from PHP to TCL.

This is a modified class of FPDF("http://www.fpdf.org/ ") (1.85) that adds support for UTF-8.

It is, therefore, a complete update of the previous version of 2014, which maintains backward compatibility, but adds full support for UTF-8.

I have tried to be as faithful as possible to the original, keeping the names and structure of programs.This way it should be possible to port the examples or addons with minimal effort.

Your comments or suggestions are always welcome.

Site

TCLFPDF is hosted in https://github.com/lamuzzachiodi/tclfpdf

Last Update

2023 - march


YS 2014-11-03: Why did you chose to port this project instead of using pdf4tcl?

LAM 2014-11-03: Actually I started this project to share the library between PHP and Tcl. This was a couple of years ago but it was not until this year that I could complete enough for general use.

DDG 2023-06-23: https://groups.google.com/g/comp.lang.tcl/c/uxA-hdvntOI describes a problem with some type of Gif files and suggests as a workaround converting them to jpeg before including them. Here an example function/use case:

proc convert-to-jpeg {file} {
    image create photo _tempimage
   _tempimage read $file
   _tempimage write mytempfile[file tail [file rootname $file]].jpeg
   rename _tempimage ""
   return mytempfile[file tail [file rootname $file]].jpeg
}

set mytempimage [convert-to-jpeg image.gif]

tclfpdf::Image $mytempimage 30 30
file delete $mytempimage 

HaO 2024-02-26: Alejandro - great work, I appreciate. Unicode auto-mode and links are features not found in pdf4tcl. Calling exit in the proc "Error" feels quite radical. Maybe, we could replace this be "return -code error $Msg"?

LES 2024-03-04: Sorry about my manners, but I can't log in at Github and open a ticket. I am just trying this for the first time, on Linux. There is an 'examples' directory with five example scripts. Two of them don't work at all, with errors I can't understand. Another one works, but instead of generating dash.pdf it generates dash.tcl i.e. it overwrites itself.


LAM - 2024-03-09 01:24:08

Hao : Thanks for your comments. I'll add some option for that in the next release.

LES : Fixed the problem with dash.tcl. I would really appreciate if you could add more information about the errors in the other examples.

LES

$ wish ./utf8.tcl 
Error in startup script: could not read "/usr/lib/tcltk/tclfpdf-1.6/font/DejaVuSansCondensed.ttf": no such file or directory
    while executing
"file stat $ttffilename ttfstat"
    (procedure "AddFont" line 31)
    invoked from within
"AddFont "DejaVu" "" "DejaVuSansCondensed.ttf" 1"
    (file "./utf8.tcl" line 7)


$ wish ./links_and_flowing_text.tcl 
Error in startup script: no such variable
    (read trace on "::env(PROCESSOR_ARCHITECTURE)")
    invoked from within
"set arch $::env(PROCESSOR_ARCHITECTURE)"
    (procedure "_readint" line 4)
    invoked from within
"_readint $f"
    (procedure "_parsepngstream" line 12)
    invoked from within
"_parsepngstream $f $file"
    (procedure "_parsepng" line 6)
    invoked from within
"_parsepng $tmp"
    (procedure "_parsegif" line 10)
    invoked from within
"$mtd $file"
    (procedure "Image" line 35)
    invoked from within
"Image "logo.gif" 10 12 30 0 "" "http://www.fpdf.org ""
    (file "./links_and_flowing_text.tcl" line 118)