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 8180177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:09:37+00:00 2026-06-07T00:09:37+00:00

I want to modify a PDF document with PHP. I found the libs FPDF

  • 0

I want to modify a PDF document with PHP. I found the libs FPDF and FPDI which allows to create and modify PDF files. Here is my very simple code:

<?php
require_once('include/fpdf.php');
require_once('include/fpdi.php');

// initiate FPDI
$pdf = new FPDI();
// add a page
$pdf->AddPage();
// set the sourcefile
$pdf->setSourceFile('input.pdf');
// import page 1
$page1 = $pdf->importPage(1);
// insert the page
$pdf->useTemplate($page1);

// now write some text above the imported page
$pdf->AddFont('calibri');
$pdf->SetFont('calibri','',11);
$pdf->Write(0, "This is just a simple text");

header("Content-Type: application/pdf");
$pdf->Output();

That works very well, but I see that the inserted text adds something like a reference to the system font instead of the already embedded font. How can I simply reuse the embedded font?

If that is not possible with that libs feel free to point me to a third free lib.


I know that I can just use characters which are already used, but this is no problem in my special case. I have checked that all possible characters are used in the right case sensitivity.

  • 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-07T00:09:38+00:00Added an answer on June 7, 2026 at 12:09 am

    I bet your embedded font from the imported PDF page is not called calibri. (Lower-case only spelling of fontnames in PDFs is very rare.)

    And I also bet, that the PDF will not have Calibri embedded as a full set. It’s rather likely that it is a subset only. And as a subset, the fontname will be composed of a random 6 letter uppercase prefix + the original font name, like this:

     AXBTZV+Calibri
    

    You have to find that exact name and try with this. (However, I’m not sure if how your PHP library works, if it can do that at all, and if it would handle the modification of the PDF text writing code in the correct way. Gimme the PDF and I most likely can do it in a Text Editor, though…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to modify the solution for highlighting trailing whitespace described here by NOT
Here is the problem: We have some pdf files with youtube videos embedded in
I want to modify my xml file in PHP based on the following criteria.
I want to modify a C program to make some of the files it
How can I modify the PDF document properties programmatically using .NET code? I have
I want to modify quicktime files, so I'm working with quicktime.py but it only
I want to modify my existing Regular Expression which accepts decimals from 0 to
I want to modify the size of the tab in css. I found the
I want to modify something in Settings.secure database, just as the android Settings app
I want to modify (Remove all white spaces) all the values of Column Name

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.