Closed thierryler closed 1 year ago
Hi @thierryler,
Indeed, could you make a pull request about it to allow to use outputFilePath to be a directory or a file ?
I do not have the skills to create a pull request on php.
In the code, I think we can simply add $outputFileName = ''
in the function parameters.
And replace
$facturxGeneratedFileName = 'invoice-facturx-'.date('Ymdhis').'.pdf';
by
$facturxGeneratedFileName = $outputFileName;
if(empty($facturxGeneratedFileName)) {
$facturxGeneratedFileName = 'invoice-facturx-'.date('Ymdhis').'.pdf';
}
I would like to split the method generateFacturxFromFiles into 2 new ones :
I can also remove the option to export on a file, because it's easy to use a file_put_content or a a resource.
Closed with #28 : I remove the method to save into file. You can use your own code to save to a file.
$writer = new \Atgp\FacturX\Writer();
$facturxPdf = $writer->generate($pdf, $facturxXml);
file_put_content('my-facturx.pdf', $facturxPdf);
Is it possible to add code to specify the wanted name (next to outputFilePath) for the generated file?
Now, I have to copy the file to change the name: