Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pdf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lib
unicaen
pdf
Commits
6df48a59
Commit
6df48a59
authored
2 years ago
by
Jean-Philippe Metivier
Browse files
Options
Downloads
Patches
Plain Diff
Merge
parent
f36fa5c5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#21721
failed
2 years ago
Stage: publish
Stage: tests
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+24
-2
24 additions, 2 deletions
CHANGELOG.md
src/UnicaenPdf/Exporter/PdfExporter.php
+17
-0
17 additions, 0 deletions
src/UnicaenPdf/Exporter/PdfExporter.php
with
41 additions
and
2 deletions
CHANGELOG.md
+
24
−
2
View file @
6df48a59
CHANGELOG
=========
1
.
0.
0
6
.
0.
1
-----
-
-
Ajout d'une fonction statique afin de simplifier le code de création de PDF dans les applications.
6.
0.0
-----
-
Version PHP 8.
5.
0.2
-----
-
Ajout d'une fonction statique afin de simplifier le code de création de PDF dans les applications.
5.
0.1
-----
-
Reprise manuelle des dernières évolutions de l'Exporter dans unicaen/app
5.
0.0
-----
-
Possibilité de passer à PHP 8.
4.
0.0
-----
-
Migration vers Laminas
-
Correctif sur la possibilité d'exporter le pdf dans un repertoire autre que /tmp
-
Extraction de ce module d'unicaen/app.
This diff is collapsed.
Click to expand it.
src/UnicaenPdf/Exporter/PdfExporter.php
+
17
−
0
View file @
6df48a59
...
...
@@ -6,6 +6,7 @@ use Laminas\View\Renderer\PhpRenderer;
use
Laminas\View\Resolver\TemplatePathStack
;
use
LogicException
;
use
Mpdf\Mpdf
as
mPDF
;
use
Mpdf\MpdfException
;
use
RuntimeException
;
/**
...
...
@@ -867,4 +868,20 @@ class PdfExporter implements ExporterInterface
$this
->
logo
=
$logoFileContent
;
return
$this
;
}
/** Fonction d'export d'un pdf générique pour factoriser le code côté application */
static
public
function
generatePdf
(
string
$filename
,
string
$titre
,
string
$corps
,
string
$headerScript
=
''
,
string
$footerScript
=
''
,
array
$vars
=
[])
:
string
{
try
{
$exporter
=
new
PdfExporter
();
$exporter
->
getMpdf
()
->
SetTitle
(
$titre
);
$exporter
->
setHeaderScript
(
$headerScript
,
null
,
$vars
);
$exporter
->
setFooterScript
(
$footerScript
,
null
,
$vars
);
$exporter
->
addBodyHtml
(
$corps
);
return
$exporter
->
export
(
$filename
);
}
catch
(
MpdfException
$e
)
{
throw
new
RuntimeException
(
"Un problème lié à MPDF est survenue"
,
0
,
$e
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment