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?
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
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
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/
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
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
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.
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
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
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 920 |
Nodes: | 10 (0 / 10) |
Uptime: | 107:08:01 |
Calls: | 12,190 |
Calls today: | 2 |
Files: | 186,527 |
Messages: | 2,237,562 |