Menu

Size background image to document

Help
2009-05-24
2015-10-22
  • joshua kitch

    joshua kitch - 2009-05-24

    Hi everyone,

    Pretty simple question here:

    I have a background image which needs to be the same size as the entire PDF page. (Just one page.)

    How to do this?

    Thanks in advance!!!! Best,
    -joshua

     
    • joshua kitch

      joshua kitch - 2009-05-24

      Thanks, but I notice you are still specifying the dimensions of the image. I want it to resize to fill the whole document, regardless of the document size.

      Thanks again!!
      -j

       
      • Nicola Asuni

        Nicola Asuni - 2009-05-25

        What do you mean for document size? the size of a single page? or all pages?
        TCPDF allows you to set a background image to fit one page at time.
        You have just to set the image size equal to the page size.

         
    • Nicola Asuni

      Nicola Asuni - 2009-05-24

      Be sure that you are using the latest TCPDF version and check the default example n. 51.
      You have just to disable the auto-page-break before inserting a full page background image.

      For example:

      $auto_page_break = $this->AutoPageBreak;
      $this->SetAutoPageBreak(false, 0);
      $img_file = K_PATH_IMAGES.'image_demo.jpg';
      $this->Image($img_file, $x=0, $y=0, $w=210, $h=297, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0);
      $this->SetAutoPageBreak($auto_page_break);

       
  • Larene Spitler

    Larene Spitler - 2015-10-22

    Thanks! It solved my problem too.

     

Log in to post a comment.