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

  • Home
  • SEARCH
  • 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 3938562
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:11:56+00:00 2026-05-20T00:11:56+00:00

I am using TCPDF with FPDI’s bridge. The issue I’m having is that as

  • 0

I am using TCPDF with FPDI’s bridge. The issue I’m having is that as soon as I use the startTransaction() I get the following error:

TCPDF ERROR: Cannot access protected property FPDI:$numpages / Undefined property: FPDI::$numpages

and the script ends (because of the die in the TCPDF::Error() method).

Here is the code I’m using:

$pdf = new FPDI();

// add a page
$pdf->AddPage();

$pdf->startTransaction();
$pdf->Cell(0, 0, 'blah blah blah');
$pdf->rollbackTransaction();

$pdf->Output( . time() . '.pdf', 'D');

If I change it to:

$pdf = new FPDI();

// add a page
$pdf->AddPage();

$pdf->Cell(0, 0, 'blah blah blah');

$pdf->Output( . time() . '.pdf', 'D');

it works fine.

Is there anyway to make them work together and use TCPDF’s transactions?

  • 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-05-20T00:11:56+00:00Added an answer on May 20, 2026 at 12:11 am

    The solution I found was to to use PHP’s object cloning which allows me to do transactions and roll them back whenever I want. Here’s an example:

    $pdf = new FPDI();
    
    // add a page
    $pdf->AddPage();
    
    $pdf->Cell(0, 0, 'blah blah blah');
    
    $_pdf = clone $pdf;
    
    // do stuff that you may want to revert
    $pdf->Cell(0, 0, 'PDFs suck!');
    
    // revert the PDF
    $pdf = $_pdf;
    
    $pdf->Output( . time() . '.pdf', 'D');
    

    The PDF will only contain “blah blah blah”.

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

Sidebar

Related Questions

Using VisualBrush, I am taking snapshots of a Window that contains a TabControl. Snapshot
Using PHP, I'd like to convert a string containing a Roman number into its
using linux commands, I have a quoted csv file which I sorted by first
using ... $this->getInvokeArg('bootstrap')->getOptions(); .. to retrieve my config settings from application.ini (using Zend Framework
Using CouchDB 1.0.1. I have DELETEd some documents, then I PUT some other documents
Using the Facebook PHP SDK, what steps do I need to take to allow
Using Maven to build my project under windows works fine, but when I build
Using Foursquare API "Venue" service.. I am parsing nearByVenue details like shop, restaurant etc.
Using Moq, RhinoMocks or a similar framework, is there a way to configure a
Using the Tab Bar template in Xcode 4, each ViewController is created automatically, so

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.