-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathProposalCinematicFileExample.java
More file actions
48 lines (40 loc) · 1.82 KB
/
Copy pathProposalCinematicFileExample.java
File metadata and controls
48 lines (40 loc) · 1.82 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
45
46
47
48
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.api.DocumentTemplate;
import com.demcha.compose.document.templates.core.theme.BrandTheme;
import com.demcha.compose.document.templates.data.proposal.ProposalDocumentSpec;
import com.demcha.compose.document.templates.proposal.presets.ModernProposal;
import com.demcha.examples.support.ExampleDataFactory;
import com.demcha.examples.support.ExampleOutputPaths;
import java.nio.file.Path;
/**
* Runnable showcase for the cinematic proposal look on the layered
* layered proposal surface — {@link ModernProposal} on
* {@link BrandTheme#proposalModern()}, rendering the shared
* {@link ProposalDocumentSpec} sample on the cream page background.
*
* @author Artem Demchyshyn
*/
public final class ProposalCinematicFileExample {
private ProposalCinematicFileExample() {
}
public static Path generate() throws Exception {
Path outputFile = ExampleOutputPaths.prepare("templates/proposal", "proposal-cinematic.pdf");
BrandTheme theme = BrandTheme.proposalModern();
DocumentTemplate<ProposalDocumentSpec> template = ModernProposal.create(theme);
try (DocumentSession document = GraphCompose.document(outputFile)
.pageSize(DocumentPageSize.A4)
.pageBackground(theme.palette().mainFill())
.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());
}
}