SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 41 of 41
  1. #26
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Salchester,

    Honestly, it sounds like you are very new to PHP. I would strongly recommend trying some simpler tasks before this. You need to make a bit of an effort to do this yourself, as well, as people here aren't going to hold your hand and step you through everything, especially without you showing some motivation and appreciation yourself for the help they are giving.

    The only way you can try to learn is to do some research yourself to try to solve these things, then ask as a last resort, but still try to understand the response.

  2. #27
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    OK, I think the issue is the encoding problem. In PDFLib Manual, page 85, table 4.2 shows a list of predefined encodings. You might wanna try several of them as it seems it is very platform defendant.

    I'm outta here.
    Saul

  3. #28
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I create PDF files (was "Need Urgent Help")

    Quote Originally Posted by php_daemon View Post
    Yes, it's php.ini. Find the line with php_pdf.dll and uncomment it. Make sure the .dll is found under the directory specified by extension_dir.

    I know nothing about xampp and the likes as I always do manual installations of php, so it's possible there are some quirks with that. Do try a sample from that article to see if it works.
    I'm having another stab and trying to get Xampp to create PDF's. What do you mean by uncomment, how do I uncomment or comment an entry?

  4. #29
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Well, commented line starts with #:

    #this is a commented line
    this is uncommented line

    So by saying 'uncomment', I mean remove the leading #
    Saul

  5. #30
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I create PDF files (was "Need Urgent Help")

    php_daemon,

    I don't have any # infront of my .dlls, I have ;
    I don't have a # in front of the extension=php_pdf.dll does this mean it's switch on?

  6. #31
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, the ; is the commenting character, Remove the ;

    Then you will need to restart Apache. If you are using XAMPP, go to the start menu, programs, Apache Friends, XAMPP, XAMPP control panel. Click the stop button next to the part saying Apache, where then it should switch from saying "running" to "stopped". Then click "start" in the same spot.

  7. #32
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't have a ; before it, does this mean its switch on/activated?

  8. #33
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It should be, yes.

    If you put this into a page:

    Code PHP:
    <?php
    phpinfo();
    ?>

    Name it phpinfo.php in your document root (C:\Porgram Files\xampp\htdocs\phpinfo.php), then go to

    http://localhost/phpinfo.php

    Somewhere on that page you should see the PDF extension mentioned.

  9. #34
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have uploaded the PHPInfo page to my freewebs.com account, does everything look in order?

    http://www.freewebs.com/mail2go/PHPInfo/phpinfo.php.htm

  10. #35
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It does. PDF seems to be enabled.

  11. #36
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So how come it's not working? (Scratching My Head)

  12. #37
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The library itself IS working, otherwise you'd only get function not found errors.

    The problem is fonts. I would experiment with different fonts and encodings.
    Saul

  13. #38
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I create PDF files (was "Need Urgent Help")

    php_daemon,

    Using PHP, is there anyway a PDF file can be created that contains only a picture, for testing purposes?

  14. #39
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yes, of course. Here's a snippet from the same article, only with text output stripped:
    Code php:
    <?php
    // create handle for new PDF document
    $pdf = pdf_new();
     
    // open a file
    pdf_open_file($pdf, "philosophy.pdf");
     
    // start a new page (A4)
    pdf_begin_page($pdf, 595, 842);
     
    // add an image under the text
    $image = pdf_open_image_file($pdf, "jpeg", "shakespeare.jpg"); pdf_place_image($pdf, $image, 50, 650, 0.25);
     
    // end page
    pdf_end_page($pdf);
     
    // close and save file
    pdf_close($pdf);
    ?>

    Of course, make sure there is image shakespeare.jpg in the same directory as the script. You can change the filename in the snippet, of course.
    Saul

  15. #40
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I create PDF files (was "Need Urgent Help")

    php_daemon,

    I have saved the image and the code in htdocs, but still get greeted with an error message.

    Fatal error: Uncaught exception 'PDFlibException' with message 'pdf_open_image_file() expects exactly 5 parameters, 3 given' in C:\Documents and Settings\Dale Piper\Desktop\xampp\htdocs\PDF.php:12 Stack trace: #0 C:\Documents and Settings\Dale Piper\Desktop\xampp\htdocs\PDF.php(12): pdf_open_image_file() #1 {main} thrown in C:\Documents and Settings\Dale Piper\Desktop\xampp\htdocs\PDF.php on line 12

    Code:
    <?php
    // create handle for new PDF document
    $pdf = pdf_new();
     
    // open a file
    pdf_open_file($pdf, "philosophy.pdf");
     
    // start a new page (A4)
    pdf_begin_page($pdf, 595, 842);
     
    // add an image under the text
    $image = pdf_open_image_file($pdf, "jpeg", "shakespeare.jpg"); pdf_place_image($pdf, $image, 50, 650, 0.25);
     
    // end page
    pdf_end_page($pdf);
     
    // close and save file
    pdf_close($pdf);
    ?>

  16. #41
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ah yes, version problems, that's an old article so might expect that:
    Code php:
    <?php
    // create handle for new PDF document
    $pdf = pdf_new();
     
    // open a file
    pdf_open_file($pdf, "philosophy.pdf");
     
    // start a new page (A4)
    pdf_begin_page($pdf, 595, 842);
     
    // add an image under the text
    $image = pdf_open_image_file($pdf, "jpeg", "shakespeare.jpg",'',0); pdf_place_image($pdf, $image, 50, 650, 0.25);
     
    // end page
    pdf_end_page($pdf);
     
    // close and save file
    pdf_close($pdf);
    ?>
    Saul


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
  •