-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProposalCinematicFileExample.java
More file actions
44 lines (36 loc) · 1.5 KB
/
Copy pathProposalCinematicFileExample.java
File metadata and controls
44 lines (36 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.demcha.examples.templates.proposal;
import com.demcha.compose.GraphCompose;
import com.demcha.compose.document.api.DocumentPageSize;
import com.demcha.compose.document.api.DocumentSession;
import com.demcha.compose.document.templates.builtins.ProposalTemplateV2;
import com.demcha.compose.document.theme.BusinessTheme;
import com.demcha.examples.support.ExampleDataFactory;
import com.demcha.examples.support.ExampleOutputPaths;
import java.nio.file.Path;
/**
* Phase E.2 — runnable showcase for {@code ProposalTemplateV2}, the
* cinematic theme-driven proposal template.
*
* @author Artem Demchyshyn
*/
public final class ProposalCinematicFileExample {
private ProposalCinematicFileExample() {
}
public static Path generate() throws Exception {
Path outputFile = ExampleOutputPaths.prepare("templates/proposal", "proposal-cinematic.pdf");
BusinessTheme theme = BusinessTheme.modern();
ProposalTemplateV2 template = new ProposalTemplateV2(theme);
try (DocumentSession document = GraphCompose.document(outputFile)
.pageSize(DocumentPageSize.A4)
.pageBackground(theme.pageBackground())
.margin(28, 28, 28, 28)
.create()) {
template.compose(document, ExampleDataFactory.sampleProposal());
document.buildPdf();
}
return outputFile;
}
public static void main(String[] args) throws Exception {
System.out.println("Generated: " + generate());
}
}