I used the header section as explained in the documentation, along with a long text to test the file in multiple pages, but the header does not show in all pages as expected. Instead, it appears as if I had used the
$header = $section->addHeader(PHPRtfLite_Container_Header::TYPE_FIRST)
code instead. Please, tell me how to circumvent this problem, as I really need all pages to have a header. Thanks.
Hello Nicole,
can you send me a sample php file that produces the issue, so I can
check it?
Best regards,
Steffen
Am 10.01.2014 11:33, schrieb Nicole Sigaud:
Related
Bugs: #40
Hello, Steffen,
Sure, it's attached in this email.
BTW, thanks for the response.
Regards,
Nicole Sigaud
On 10/01/2014 19:12, Steffen Zeidler wrote:
As I reviewed your sample I realized that you added text and image to $Hsect (which is the section, not the header). Add text and image to $header and it should work for you.
Please let me know, if it still is not working.
Dear,
Somewhat bizarre what happened, but here it goes:
To make the header show on all pages the code became as follows - no
addSection(); $header = $Hsect->addHeader(PHPRtfLite_Container_Header::TYPE_ALL); /*=== HEADER FORMATTING === */ $Hfont = new PHPRtfLite_Font(12, 'Verdana'); $Hfont->setBold(); $HeaderParFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER); $PageNumFormat = new PHPRtfLite_Font(8, 'Verdana'); $PageNumParFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_RIGHT); /*=== HEADER IMAGE AND TEXT === */ $header->writeText('', new PHPRtfLite_Font(), $HeaderParFormat); $table = $header->addTable(); $table->addRows(4); $table->addColumnsList(array(15)); $cell = $table->getCell(1, 1); $cell->setTextAlignment(PHPRtfLite_Table_Cell::TEXT_ALIGN_CENTER); $image = $table->addImageToCell(1, 1, '../images/logo.png'); $table->writeToCell(2, 1, 'FIRST LINE', $Hfont, $HeaderParFormat); $table->writeToCell(3, 1, 'SECOND LINE', $Hfont, $HeaderParFormat); $table->writeToCell(4, 1, 'THIRD LINE', $Hfont, $HeaderParFormat); $header->writeText('pág. <pagenum> de <pagetotal>', $PageNumFormat, $PageNumParFormat); ............................................... Now the bizarre part: The header command accepted the lines, but not with the image. Putting as follows the header appeared only in the last page (!) $header->writeText('', new PHPRtfLite_Font(), $HeaderParFormat); $imageFile = '../images/logo.png'; $image = $header->addImage($imageFile); $header->writeText('FIRST LINE', $Hfont, $HeaderParFormat); $header->writeText('SECOND LINE', $Hfont, $HeaderParFormat); $header->writeText('THIRD LINE', $Hfont, $HeaderParFormat); $header->writeText('pág. <pagenum> de <pagetotal>', $PageNumFormat, $PageNumParFormat); ................................... Anyway, thanks for the help! Now that I managed to fix this I have to make the main text body come through a form, including pictures and eventually tables as well, maybe integrating with a JavaScript editor like CKEditor. Cheers Nicole Sigaud On Tue, Jan 14, 2014 at 7:15 PM, Steffen Zeidler <sigmaz@users.sf.net>wrote: > As I reviewed your sample I realized that you added text and image to > $Hsect (which is the section, not the header). Add text and image to > $header and it should work for you. > > Please let me know, if it still is not working. > ------------------------------ > > * [bugs:#40] <http: sourceforge.net="" p="" phprtf="" bugs="" 40=""> Header only on > first page, not others* > > *Status:* open > *Labels:* header > *Created:* Fri Jan 10, 2014 10:33 AM UTC by Nicole Sigaud > *Last Updated:* Tue Jan 14, 2014 09:00 PM UTC > *Owner:* Steffen Zeidler > > I used the header section as explained in the documentation, along with a > long text to test the file in multiple pages, but the header does not show > in all pages as expected. Instead, it appears as if I had used the > > $header = $section->addHeader(PHPRtfLite_Container_Header::TYPE_FIRST) > > code instead. Please, tell me how to circumvent this problem, as I really > need all pages to have a header. Thanks. > ------------------------------ > > Sent from sourceforge.net because you indicated interest in > https://sourceforge.net/p/phprtf/bugs/40/ > > To unsubscribe from further messages, please visit > https://sourceforge.net/auth/subscriptions/ > ?></http:></sigmaz@users.sf.net></pagetotal></pagenum></pagetotal></pagenum>problem and it worked fine, with the table aligned at center: