SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,169
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)

    Need Help with FPDF

    Okay, I am struggling here. For whatever reason, when using Cell or MultiCell, I can't get the spaces in my test to be written out...
    http://cpradio.no-ip.info:12710/clie...ntList/pdf.php

    I am 100% new to FPDF and FPDI, etc. I am using both, as I need to use a template. Below is the code I have so far:
    Code php:
    <?php
      require_once('../include.php');
      require_once('pdf-templates/fpdf.php');
      require_once('pdf-templates/fpdi.php');
      session_start();
     
      $pdf = new FPDI('P', 'pt', 'Letter');
      $pdf->AddPage('P', 'Letter');
      $pdf->setSourceFile('template-copy.pdf');
      $templatePage = $pdf->importPage(1);
      $pdf->useTemplate($templatePage, 0, 0, 0, 0, true);
      $pdf->SetFont('Arial', 'B', 28);
      $pdf->SetTextColor(159, 31, 32);
      $pdf->SetDrawColor(159, 31, 32);
      $pdf->SetXY(0, 180);
      $pdf->MultiCell(0, 15, '2002 Baja 250 Islander Center Console', 0, 'C', false);
      $pdf->Output(Configuration::LOCAL_OUTPUT_FOLDER . 'pdf/test.pdf', 'I');
    ?>

    Anyone with more experience on this than I, please help me. I haven't found anything in my searches that explains this output weirdness.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,839
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Can you provide more information about the problem. As far as I can see the output is being produced exactly as specified. Just which part isn't working the way you want?
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,169
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    On my screen, the text "2002 Baja 250 Islander Center Console" shows up as "2002Baja250IslanderCenterConsole". The spaces are removed... Does that not happen for anyone else?

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,169
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    Well what do you know. Seems Chrome's built in PDF viewer may be doing this to me. I opened it in Opera and the text shows up correctly.

  5. #5
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,087
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    It seems this is a known bug in Chrome: http://code.google.com/p/chromium/is...etail?id=53553

    Are you using the Arial font that comes with FPDF? I've had some kerning problems with FPDF in the past and it's not easy to solve without messing around in all sorts of weird character definition files.

    I did find this site which will create definition files for a font you supply that works pretty well http://fpdf.fruit-lab.de/index.php?id=3

    Altough if you use the default supplied font that should work just fine.

    Does the problem also occur on different font sizes btw?
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  6. #6
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,169
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    Hi ScallioXTX,

    Yes, I am using the built in Arial font. Simply because it was there and I didn't want to mess with definition files (being my first use of FPDF). Happens at all font sizes.

    Not sure if it occurs in Safari, but I'm not worried, as I just changed the output from inline to download, so the user will be required to save it before opening (thus it should open in their default pdf reader application, not Chrome).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •