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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:53:00+00:00 2026-06-17T16:53:00+00:00

I think this will be an easy answer but I just can’t figure it

  • 0

I think this will be an easy answer but I just can’t figure it out.

I have a script that generates a pdf using fpdf and fpdi.

If I use a normal image then the pdf generates perfectly but I am trying to use an image generated dynamically by php.

$bc = new PrintBarcode('DARP CODE');
$bc->drawVoucher();
$src = $bc->getVoucher();

// image
$src = $bc->getVoucher();

$pdf->Image($src, 22, 94, 100, 15);

This gives the error:

FPDF error: Image file has no extension and no type was specified: Resource id #16

If I do

$barcode = imagejpeg($src);
$pdf->Image($barcode, 22, 94, 100, 15);

presumably because the imagejpeg is actually outputting the image but the image header is set because if the jpeg header is set the image will display fine so I’m just trying to figure out the correct way of doing this.

If it’s easier, I have a separate script which can generate the image, e.g. `printbarcode.php’ but I don’t know how to get the contents of that script into this function:

$pdf->Image($barcode, 22, 94, 100, 15);

  • 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-17T16:53:01+00:00Added an answer on June 17, 2026 at 4:53 pm

    From the error message I would guess that the $pdf->Image() function is expecting $src to be a path to a file. What you are passing seems like a object.

    Try saving the image to disk and loading from there. You are almost there with imagejpeg() function – see docs on php.net. Supply a path to save the file

    imagejpeg($img, 'myfile.jpg', 90); // 90 denotes high quality
    $pdf->Image('myfile.jpg', 22, 94, 100, 15);
    ...
    unlink('myfile.jpg'); // delete after
    

    or alternatively look for a function on the fpdf library that takes image resource as a parameter.

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

Sidebar

Related Questions

I think this will be easy but I can't see how to do it!
I think this could be a very easy question for you. But I have
I have a general question that may be easy to answer, but it might
I have the notion that this is very easy and over-documented, but I have
Do you think that C# will support something like ??= operator? Instead of this:
I have this thing that i need to do and some advices will be
Hopefully this will be an easy one to answer. I am working on a
I think this question should be something easy but after searching all over the
(I think this is a pretty basic question on OOP, but unfortunately I wasn't
I think this is a simple and a silly question. I have included a

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.