Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF attachments #5

Merged

Conversation

devmount
Copy link
Contributor

@devmount devmount commented Jan 10, 2025

This PR offers a trait to add file attachments to PDF files.

It can be used similar to the already existing traits:

use fpdf\PdfDocument;
use fpdf\Traits\PdfAttachmentTrait;

class AttachmentDocument extends PdfDocument
{
    use PdfAttachmentTrait;
}

$file = "test/attached.txt";

$pdf = new AttachmentDocument();
$pdf->addPage();
$document->attach($file);
$document->openAttachmentPane();

$pdf->output();

It also provides tests and documentation for this trait.

Fixes #4

@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@laurentmuller laurentmuller merged commit 9e6b7a7 into laurentmuller:main Jan 14, 2025
9 of 10 checks passed
@devmount devmount deleted the enhancements/4-pdf-attachments branch January 15, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add attachments
3 participants