Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

PDFMerger not merging pdf file #14

Open
nikunjgajera opened this issue Apr 18, 2019 · 1 comment
Open

PDFMerger not merging pdf file #14

nikunjgajera opened this issue Apr 18, 2019 · 1 comment

Comments

@nikunjgajera
Copy link

I need to merge pdf file and create new pdf file but i get below exception

{
    "message": "Unable to find xref table.",
    "exception": [
        {
            "type": "Exception",
            "code": 0,
            "message": "Unable to find xref table.",
            "file": "\/var\/www\/app\/vendor\/rguedes\/pdfmerger\/Classes\/fpdi\/pdf_parser.php",
            "line": 330
        }
    ]
}

my composer.json file is below

 "require": {
        "php": ">=5.6",
        "ext-gd": "*",
        "composer/installers": "^1.4.0",
        "symfony/console": "^3.3",
        "wikimedia/composer-merge-plugin": "dev-master",
        "onelogin/php-saml": "^2.12",
        "fpdf/fpdf": "^1.81",
        "rguedes/pdfmerger": "dev-master"
    },

my php code is below

use PDFMerger;

$pdfMerger = new PDFMerger();

$pdfMerger->addPDF('test1.pdf');
$pdfMerger->addPDF('test2.pdf');
$pdfMerger->addPDF('test.pdf');

$pdfMerger->merge('merged.pdf');

let me know how to solve this exception?

@nikunjgajera nikunjgajera changed the title PDFMerget not merging pdf file PDFMerger not merging pdf file Apr 18, 2019
@LisaW9
Copy link

LisaW9 commented Apr 24, 2019

I think you need to specify the output option

See documentation:

$pdf->merge('file', 'samplepdfs/TEST2.pdf'); 
    
// REPLACE 'file' WITH 'browser', 'download', 'string', or 'file' for output options

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants