Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8453709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:49:51+00:00 2026-06-10T11:49:51+00:00

Is it possible to embedd a pdf file into another using php? If not

  • 0

Is it possible to embedd a pdf file into another using php?
If not php, can this be made using another open source software?

The use case is the following:

I have a template.pdf file with empty spots which should be filled dynamically
with another pdf files.

Example:

I have a pdf file with four empty slots, the firts three should be filled
with the contents of pdf files: a.pdf, b.pdf, c.pdf and the last one should
be filled with text dinamically created.

template.pdf

+-----------------------+-------+-------+
|         a.pdf         | b.pdf | c.pdf |
+-----------------------+-------+-------+
|        embedded dynamic text          |
+---------------------------------------+
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:49:53+00:00Added an answer on June 10, 2026 at 11:49 am

    I was able to fulfill my requirements using tcpdf.php and fpdi.php.

    It’s not the most beautiful code, but It’s working.

    <?php
    
    require_once dirname(__FILE__) . '/pdf-lib/tcpdf/tcpdf.php';
    require_once dirname(__FILE__) . '/pdf-lib/fpdi/fpdi.php';
    
    
    $my_base_path = dirname(__FILE__);
    
    
    $pdf = new FPDI('P', 'mm', 'LETTER', true, 'UTF-8', false, true);
    
    
    //following is the style pf the boxes
    $style = array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0,  'color' => array(0, 0, 0));
    
    /*
     * Set the template file
     */
    $pdf->setSourceFile($my_base_path . '/template.pdf');
    $tplidx = $pdf->ImportPage(1);
    $pdf->addPage();
    $pdf->useTemplate($tplidx);
    
    /*
     * Set file1.pdf
     * Width of a.pdf + b.pdf
     */
    $pdf->setSourceFile($my_base_path . '/file1.pdf');
    $pdf->setPage(1);
    $tplidx = $pdf->ImportPage(1);
    $size = $pdf->useTemplate($tplidx, 12.4, 25.90, 124);
    $pdf->Cell(12.4, 26.67);
    $pdf->Rect(80.29, 62.147, 55.919, 62.815, 'D', $style);// box around the ballot
    
    /*
     * Set file2.pdf
     * Width of c.pdf
     */
    $pdf->setSourceFile($my_base_path . '/file2.pdf');
    $pdf->setPage(1);
    $tplidx = $pdf->ImportPage(1);
    $size = $pdf->useTemplate($tplidx, 147.29, 26.67, 56.0);
    $pdf->Cell(147.29, 26.67);
    $pdf->Rect(147.349, 62.147, 55.919, 62.815, 'D', $style);// box around the ballot
    
    
    
    /*
     * Set embedded dynamic text
     */
    
    $text = 'embedded dynamic text';
    
    $pdf->setPage(1);
    $pdf->setXY(12.6, 147.24);
    
    //$pdf->Cell(0, 0, $text_nombre, 0, 0, 'C');
    $pdf->writeHTMLCell(0, 0, 12.6, 147.24, $text, 0, 0, 0, true, 'C');
    
    
    $pdf->Output('out.pdf', 'I');
    exit;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is is possible to embedd a TextBox in another TextBox. It does not have
I would like to know how can I embedd a code source file (if
does somebody know how can I embedd an exe file into a dll ?
I'm not even sure if this is possible. Can you create a hyperlink or
Is it possible to embed a PowerPoint presentation (.ppt) into a webpage (.xhtml)? This
Is it possible to embed a Gtk widget into an application using System.Windows.Forms? Thanks!
Is it possible to embed an ActiveXObject (in this case, the 3DVia Viewer) into
This is in reference to this answer: Embed png image in html file using
It's possible to embed php code in symfony's yml fixture file. My table entry
is it possible to embed this into html if (empty($_POST['extras'])) { $message .=<br />

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.