Comments (2)
#236 was closed, not sure why. But you can still use this functinality if you extend the original Fpdi
class. Below is an example:
<?php
namespace App\Services;
use setasign\Fpdi\Tcpdf\Fpdi;
use TCPDF_STATIC;
class RFPDI extends Fpdi
{
public function createPDF() {
$attachment = storage_path('/app/logos/0Zs80Mh5mhfc7g213Ui33qov8X9gXyhKDCSLOvmG.png');
$this->Attachment($attachment);
}
public function Attachment($filestream) {
if (!$this->pdfa_mode || ($this->pdfa_mode && $this->pdfa_version == 3)) {
if ((!TCPDF_STATIC::empty_string($filestream))
AND (@TCPDF_STATIC::file_exists($filestream) OR TCPDF_STATIC::isValidURL($filestream))
AND (!isset($this->embeddedfiles[basename($filestream)]))) {
$this->embeddedfiles[basename($filestream)] = array('f' => ++$this->n, 'n' => ++$this->n, 'file' => $filestream);
}
}
}
}
from tcpdf.
I looked into this a bit (I work with wangshy at Digital Echidna) and I think the issue we were having was that we assumed an attachment had to be added as a PDF annotation (and this seems to be the only way to do it in TCPDF). However, adding the attachment and the annotation are actually two separate steps and you can have an attachment without an annotation.
I'm not sure this is strictly speaking a bug (possibly Acrobat Reader just always displays duplicates when there's an attachment referenced in an annotation and this therefore isn't a problem in tcpdf?) but since we were using the attachments tab to reference the connected files and not actually using the annotation (it was just stuck in the corner of the file barely noticeable) the easiest workaround is to just do the attachment without the annotation.
I've opened a PR here that adds a method for that: #236
It can be used like so:
$this->tcpdf->Attachment($attachment);
from tcpdf.
Related Issues (20)
- TCPDF Tamil font not working properly
- Extra space with img tag using writeHTML function with MultiCell
- List of HTML tags supported by TCPDF
- Images potentially misplaced when using SetRTL() after update to 6.7.2 HOT 1
- Multicell borders over page break
- Regression in 6.7.2 - undefined index error HOT 1
- add xyekan font HOT 1
- With the new update to 6.7.2, the usage of Mutlicell is showing Undefined Array key -1 error with php 8.1
- Update comment for renamed serializeTCPDFtagParameters
- print pdf bug: when the page more then 1000
- Font file cannot be found on unix system because auf case sensitivity
- Snyk path traversal vulnerability HOT 8
- Using form fields relies on helvetica font
- Baroce label design look weird. NEED HELP
- Disappeared 6.7.x tags HOT 10
- TCPDF vulnerable to Regular Expression Denial of Service
- setPageFormat() HOT 4
- missing Documentation on K_ALLOWED_TCPDF_TAGS HOT 2
- Exclude indents from the nested tables HOT 1
- Some kanji characters cannot be displayed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tcpdf.