karriereat / pdf-merge Goto Github PK
View Code? Open in Web Editor NEWThis package is a wrapper for the TCPDF class that provides an elegant API for merging PDF files.
Home Page: https://packagist.org/packages/karriere/pdf-merge
License: Other
This package is a wrapper for the TCPDF class that provides an elegant API for merging PDF files.
Home Page: https://packagist.org/packages/karriere/pdf-merge
License: Other
Hi, your code works fine and I can merge PDFs, it just throws some errors in the background - seems $data is either not an array or something else is happening there?
Error: Uninitialized string offset 54 on line: 843 in /var/www/site/vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php
Error: Uninitialized string offset 720 on line: 843 in /var/www/site/vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php
Error: Uninitialized string offset 54 on line: 843 in /var/www/site/vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php
Error: Uninitialized string offset 821 on line: 843 in /var/www/site/vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php
Error: Uninitialized string offset 54 on line: 843 in /var/www/site/vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php
Error: Uninitialized string offset 229 on line: 843 in /var/www/site/vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php
It was 2x 1-page PDFs that were being merged - not sure if that helps or not?
I have a process of filling in a PDF fields on a blank pdf then using use use PdfMerge to merge it into another document. The process works perfectly on php 7.4, but when i moved it to a new host on php 8.1 or 8.2 it does merge, but it also removes the changes that were made. so the end result is empty.
Can confirm the existence of pdf1 and pdf2 and both look perfectly fine prior, just merged it is getting removed. any ideas?
use Karriere\PdfMerge\PdfMerge;
$pdfMerge = new PdfMerge();
$pdfMerge->add($pdf1);
$pdfMerge->add($pdf2);
$pdfMerge->merge($outputFile);
I tried merging a 'letter' PDF with a 'landscape' PDF -- the result was that the landscape PDF was cut off on the right side. Any ideas on how to detect if a PDF is landscape mode and either rotate it or merge it as a landscape page (as Acrobat does)?
20221028213726_92477adf_letter_PDF.pdf
20221028213726_e6fdf4ce_landscape_PDF.pdf
pid68_formConsent_id2_2022-10-28_213726-2.pdf
Hi ! I tried to use your package to merge PDFs and it works well, thank you!
However, at the installation via composer, I got this warning :
Warning: Ambiguous class resolution, "FPDF" was found 2x: in "C:/laragon/www/lapli/vendor/karriere/pdf-merge/tcpi/tcpdi.php" and "C:\laragon\www\lapli\vendor/setasign/fpdf/fpdf.php", the first will be used.
As you can see, I already use another package "Setasign/FPDF" to manipulate PDFs. It was fine to use it, until I couldn't because of a newer version of PDF (the reason I installed your package).
Now the problem is that my previous code using the Setasign package does not work anymore. I get this error :
Declaration of setasign\Fpdi\FpdfTplTrait::setPageFormat($size, $orientation) should be compatible with TCPDF::setPageFormat($format, $orientation = 'P')
Unfortunatly, I have no idea how to fix that T_T
Do you have some suggestions ?
Hi,
My implementation has worked great for a couple of weeks, until a couple of days ago, where I get the following error when trying to merge PDFs:
Allowed memory size of 536870912 bytes exhausted (tried to allocate 67108872 bytes)
at vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php:999
The files in question are:
cover_1700084041.pdf -> 143kb
file_9a9f2a78-c516-4e99-86b2-82039c7bdda9.pdf -> 1.1MB
termsAndConditions_1700084044.pdf -> 166 kb
I have confirmed that all PDFs are available at the provided path, and have also renamed the file names to see if special characters are the issue.
Previously I've had no issues merging over 30 pdf documents, many of them a couple of megabytes each.
Does anyone have any idea of what causes this issue?
Hi, I am encountering the following error "TCPDF ERROR: Template does not exist!" when trying to merge a specific PDF. How can I solve it? I cannot understand what it depends on, or rather what has that PDF that generates this error.
There should not be these default header/footer lines added
print_header
& print_footer
are default true
which can`t be changed with this library
Currently, I am forced to do this:
$pdfMerge = new PdfMerge(
['lc' => [255, 255, 255]], // normally we should not do this
['lc' => [255, 255, 255]], // normally we should not do this
);
First, thank you for your contributions to the community -- your efforts are very much appreciated
We have a PDF that can be opened and viewed without a password. However, the pdf does require a password for saving changes to the document.
We would like to create a merged PDF that includes the previously mentioned PDF but the process fails. Per developer,
fails when trying to import page (PDFMerge::merge() line 77) from password-protected PDF. It goes inside into tcpdi::ImportPage line 232 $parser->getContent() next to tcpdi_parser::getContent and fails in _rebuildContentStream() on line 1375
Should this work? Do you have any ideas for a workaround for how to handle this?
Can PDFs in different directions be merged?
setOrientation L ?
I'm able to use and works perfectly combining PDF's if I define out each individual file.
However when I used it in an array I get the below error. These individual files I am able to do without an array and it works fine.
foreach ($final_array as $file) {
$filez = $file['file_path'];
$pdfMerge->add($filez);
}
Error
Notice: Uninitialized string offset: 3670 in /vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php on line 709
Notice: Uninitialized string offset: 3670 in /vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php on line 713
Notice: Uninitialized string offset: 3670 in /vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php on line 815
Hello!
A security vulnerability, identified as CVE-2024-32489, has been found in the tcpdf package. This vulnerability affects tcpdf versions prior to 6.7.4.
I noticed that the project currently uses tcpdf 6.3. Would it be possible to upgrade to the latest version (6.7.4) to mitigate this security risk?
Thanks in advance for your attention to this matter.
Hi there,
On PHP 8.2 there are deprecation warnings like PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in karriere/pdf-merge/tcpi/fpdf_tpl.php on line 278
Do you have plans to release support for PHP 8.2?
Got that exception. Here's the full exception:
/lav-im/vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php#737ErrorException
$objtype = ''; // object type to be returned
$objval = ''; // object value to be returned
// skip initial white space chars: \x00 null (NUL), \x09 horizontal tab (HT), \x0A line feed (LF), \x0C form feed (FF), \x0D carriage return (CR), \x20 space (SP)
while (strspn($data[$offset], "\x00\x09\x0a\x0c\x0d\x20") == 1) {
$offset++;
}
// get first char
The code is straight forward, this is it:
$pages = $this->book->pages;
$pdfMerge = new PdfMerge();
foreach ( $pages as $pagePdf ) {
$pageFileName = $pagePdf->fullPathFileName;
$pdfMerge->add($fullPathFileName);
}
$pdfMerge->merge('fullBook.pdf');
Hi... i want to ask why i got this error.
this is my code :
$pdfMerge = new PdfMerge();
$pdfMerge->add($value['dok1']);
$pdfMerge->add($value['dok2']);
$pdfMerge->add($value['dok3']);
$pdfMerge->add($value['dok4']);
$path = base_url('folder') . "/" . $nameFile;
$pdfMerge->merge($path);
$value['dok1'] ,etc have a value
but i still got this file not found error
i use php 7.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.