PhilterPaper / Perl-PDF-Builder

Extended version of the popular PDF::API2 Perl-based PDF library for creating, reading, and modifying PDF documents
https://www.catskilltech.com/FreeSW/product/PDF%2DBuilder/title/PDF%3A%3ABuilder/freeSW_full
Other
6 stars 7 forks source link

CTS 26 - observation(s): fonts will be the death of me #114

Closed westmj closed 4 years ago

westmj commented 4 years ago

I try, I do. I figured DejaVu ttf font would solve my problems. I thought studying the documentation would solve my problems. But getting data from .xlsx or text-input, I can't make heads or tails of getting searchable text... but it seems like defaults should give that. And, why oh why, does copying "some" put "VRPH" in my paste buffer. Just kill me now.

By the way, I got your latest PDF::Table installed, so am migrating away from PDF::API2 to Builder. Thanks for all your hard work. Sorry to be such a newbie, please excuse my newbie ignorance.

accents.zip

PhilterPaper commented 4 years ago

I know that TTF text was unsearchable in 3.016 and 3.017. Sorry about that. The fix is in 3.018, which will be released this month. If you want, you can compare lib/PDF/Builder/Resource/CIDFont.pm on GitHub and make the changes to your copy. See if it also fixes the odd buffer copy too. I can't run your example without installing several additional packages, which I'm hoping to avoid doing. If updating your CIDFont.pm doesn't help, I'll go ahead and install them to try to replicate the buffer problem.

I was thinking about contacting you in regards to the 010_fonts.pl PR that you submitted to PDF::Table, and Desislav pulled in to the master copy yesterday. What exactly are you trying to demonstrate with that program, now knowing that corefonts can't support UTF-8 encoding? Is it still useful for other purposes?

westmj commented 4 years ago

I can likely write the example with a minimum of "use xxx;" if helpful. But hearing you are aware, and help is already in the pipeline, is VERY encouraging. I likely can wait, however, does github already incorporate the proposed fixes? I think I am getting better with github, might try upgrade to latest GitHub rather than cpan. Thanks much for your help.

Mike West mwjwest@gmail.com

Phone & WhatsApp: +1-302-559-3642 Address: Casa Alquimía 350 m SUR y 80 m ESTE de la Gasolinera Monteverde Monteverde, Puntarenas, Costa Rica 60109 www.facebook.com/mwjwest mwjwest.wordpress.com

On Wed, Apr 8, 2020, 9:59 AM Phil Perry notifications@github.com wrote:

I know that TTF text was unsearchable in 3.016 and 3.017. Sorry about that. The fix is in 3.018, which will be released this month. If you want, you can compare lib/PDF/Builder/Resource/CIDFont.pm on GitHub and make the changes to your copy. See if it also fixes the odd buffer copy too. I can't run your example without installing several additional packages, which I'm hoping to avoid doing. If updating your CIDFont.pm doesn't help, I'll go ahead and install them to try to replicate the buffer problem.

I was thinking about contacting you in regards to the 010_fonts.pl PR that you submitted to PDF::Table, and Desislav pulled in to the master copy yesterday. What exactly are you trying to demonstrate with that program, now knowing that corefonts can't support UTF-8 encoding? Is it still useful for other purposes?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PhilterPaper/Perl-PDF-Builder/issues/114#issuecomment-611043316, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHPAFELX4VCZLSR6AJRHUTRLSNO7ANCNFSM4MDRZ4AQ .

PhilterPaper commented 4 years ago

Yes, the changes to CIDFont.pm are on GitHub. Click "code" and navigate to CIDFont.pm. Click "history", select the first (most recent), and you'll see the change to 3 lines. That should work OK with a 3.017 installation.

My question about 010_fonts.pl was "what is this supposed to show?". If it's to demonstrate that UTF-8 text doesn't work with corefont(), there's no point in putting that in the examples. It's now documented, and corefont() will reject that encoding anyway. If it shows something else that is useful as an example, you or I can clean it up and keep it.

westmj commented 4 years ago

Thanks, I will look into it. Likely I will try perl Makefile.pl and make , make install unless you recommend against it.

about 010_fonts.pl , part of my confusion about "use utf8;" is the effect on BOTH output to terminal, and to PDF, and the plethora of conflicting advice outside of here. Rather than more blah blah blah, I wrote code that SHOWs it. An example, yes, repetitive and redundant, but from another angle; code not words. Some go to docs to understand, some to code. Let a thousand flowers bloom. Or, what does it hurt to let a weed live in a walked garden?

Mike West mwjwest@gmail.com

Phone & WhatsApp: +1-302-559-3642 Address: Casa Alquimía 350 m SUR y 80 m ESTE de la Gasolinera Monteverde Monteverde, Puntarenas, Costa Rica 60109 www.facebook.com/mwjwest mwjwest.wordpress.com

On Wed, Apr 8, 2020, 1:50 PM Phil Perry notifications@github.com wrote:

Yes, the changes to CIDFont.pm are on GitHub. Click "code" and navigate to CIDFont.pm. Click "history", select the first (most recent), and you'll see the change to 3 lines. That should work OK with a 3.017 installation.

My question about 010_fonts.pl was "what is this supposed to show?". If it's to demonstrate that UTF-8 text doesn't work with corefont(), there's no point in putting that in the examples. It's now documented, and corefont() will reject that encoding anyway. If it shows something else that is useful as an example, you or I can clean it up and keep it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PhilterPaper/Perl-PDF-Builder/issues/114#issuecomment-611158587, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHPAFHX2DSNQGB7CVLPWETRLTIP5ANCNFSM4MDRZ4AQ .

westmj commented 4 years ago

It worked! Thank you very much. Whatever the magic is, you got it.

I installed with

perl Makefile.PL make make install

perl PDF-Builder-accents.pl

The resulting PDF is searchable, and copying puts what you expect in the paste buffer.

What is the magic? For wuggles... accent.pdf

PhilterPaper commented 4 years ago

I'm afraid that such magic is off limits to muggles!

westmj commented 4 years ago

$gid? $uni? Your secrets are safe from me.

Regards, Mike "Muggles" West

PhilterPaper commented 4 years ago

Now we will have to send out some loathsome, horrid creatures to permanently silence you! Perhaps a venom-spitting flying snake that melts your lips together? ("Wuggles"? Oh dear.)

Yeah, $gid is the Glyph ID, the font-dependent index number; $uni is the Unicode number for the character. Unicode numbers can correspond to multiple glyphs (and Glyph IDs), and not all glyphs have a Unicode number. A couple of lines had a typo where usage of the two got mixed up during some editing.

westmj commented 4 years ago

Thanks for that! I think I have a glimpse at the magic. Ok, like I said, you can kill me now. And even close this thread. Cheers!

Mike West mwjwest@gmail.com

Phone & WhatsApp: +1-302-559-3642 Address: Casa Alquimía 350 m SUR y 80 m ESTE de la Gasolinera Monteverde Monteverde, Puntarenas, Costa Rica 60109 www.facebook.com/mwjwest mwjwest.wordpress.com

On Thu, Apr 9, 2020, 3:18 PM Phil Perry notifications@github.com wrote:

Now we will have to send out some loathsome, horrid creatures to permanently silence you! Perhaps a venom-spitting flying snake that melts your lips together? ("Wuggles"? Oh dear.)

Yeah, $gid is the Glyph ID, the font-dependent index number; $uni is the Unicode number for the character. Unicode numbers can correspond to multiple glyphs (and Glyph IDs), and not all glyphs have a Unicode number. A couple of lines had a typo where usage of the two got mixed up during some editing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PhilterPaper/Perl-PDF-Builder/issues/114#issuecomment-611757466, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHPAFFGXC4J6FCEZEG7UVTRLY3TDANCNFSM4MDRZ4AQ .

PhilterPaper commented 4 years ago

Will close when 3.018 released later this month.