Skip Menu |

This queue is for tickets about the PDF-TextBlock CPAN distribution.

Report information
The Basics
Id: 74087
Status: resolved
Priority: 0/
Queue: PDF-TextBlock

People
Owner: Nobody in particular
Requestors: bitcard [...] krueger-de.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.04
Fixed in: (no value)



Subject: PDF::TextBlock::Font->new
A defined font is not be used in floattext . Only if i use a html tags like <b> the following text will use the comic font. Is this a bug or can't i use ttf fonts in TextBlock ?
On Tue Jan 17 09:28:45 2012, Webhopper wrote: Show quoted text
> A defined font is not be used in floattext . > Only if i use a html tags like <b> the following text will use the comic font. > Is this a bug or can't i use ttf fonts in TextBlock ?
What is 'floattext'? You can use any ttf fonts you want. From the PDF::API2 docs, you do $font = $pdf->ttfont('/path/to/font.ttf'); instead of $font = $pdf->corefont('Helvetica-Bold'); So anywhere you're providing a corefont() to PDF::TextBlock, feel free to provide a ttfont() instead. Did that help? Cheers, j
From: bitcard [...] krueger-de.org
Am Di 17. Jan 2012, 12:33:32, JHANNAH schrieb: Show quoted text
> What is 'floattext'?
Is "floating text" as description better ? Show quoted text
> You can use any ttf fonts you want. > From the PDF::API2 docs, you do > $font = $pdf->ttfont('/path/to/font.ttf');
I have defined: my $pdf = PDF::API2->open('template.pdf'); my @directories = PDF::API2::addFontDirs ('C:/WINDOWS/Fonts/', 'C:/WINNT/Fonts/'); my $page = $pdf->openpage(0); my $font = $pdf->ttfont('comic.ttf'); for the font access. For placement the text with API2 the correct font will be used: my $text = $page->text(); $text->font($font, 10); $text->translate(48, 585); $text->text('blah blah blah ...'); I use textblock with this code: my $tb1 = PDF::TextBlock->new({ pdf => $pdf, page => $pdf->openpage(0), x => 40, y => 490, w => 510, h => 500, align => 'left', fonts => { b => PDF::TextBlock::Font->new({ pdf => $pdf, font => $pdf->ttfont('C:/WINNT/Fonts/comic.ttf'), }), }, }); $tb1->text('blah blah blah ....' $tb1->apply; Not all the words was shown with the specified font. This problem often occurs for line breaks ... The font was correct shown if i used this text code: $tb1->text('<b>blah <b>blah <b>blah <b>....' Greetings, Andreas
CC: Nebraska USA Perl Mongers of Omaha <omaha-pm [...] pm.org>
Subject: Re: [rt.cpan.org #74087] PDF::TextBlock::Font->new
Date: Tue, 24 Jan 2012 17:30:54 -0600
To: bug-PDF-TextBlock [...] rt.cpan.org
From: Jay Hannah <jay [...] jays.net>
On Jan 22, 2012, at 1:44 AM, Andreas Krueger via RT wrote: Show quoted text
> fonts => { > b => PDF::TextBlock::Font->new({ > pdf => $pdf, > font => $pdf->ttfont('C:/WINNT/Fonts/comic.ttf'), > }), > }, > }); > $tb1->text('blah blah blah ....' > $tb1->apply; > Not all the words was shown with the specified font. This problem often occurs for line breaks ...
Huh. So if you do $tb1->text('blah <b>blah</b> blah'); It seems to work, but with really long examples that end up on multiple lines it sometimes doesn't work? Can you send me a real example and the .pdf that is generated so I can look at both? I don't use Windows, but if I can reproduce it on Linux or OSX then I could see how I might fix it. Show quoted text
> The font was correct shown if i used this text code: > $tb1->text('<b>blah <b>blah <b>blah <b>....'
Umm... Every <b> needs a </b> to have any chance of working as I originally expected. I have no idea what <b> <b> <b> does. :) Thanks, j
From: bitcard [...] krueger-de.org
Hi Jay Thanks for your help. It seems as I had misunderstood your instructions. With your new information I get the point now. However, I didn't understand why I must be use the <b> tag to use the defined font. I still have a font defined. It seems to be a layer eight problem ;-) My notes are in the source code in top of the of the used text block. Greetings, Andreas
Subject: TextBlock_BugID_74087.zip
Download TextBlock_BugID_74087.zip
application/x-zip-compressed 226.3k

Message body not shown because it is not plain text.

Hi Andreas, I think this was resolved. If not, can you please open an issue in github? https://github.com/jhannah/pdf-textblock/issues Thanks, :) j