Uses 5264K of libraries. Click here for Pure Java version (2317L/13K).
1 | !7 |
2 | |
3 | import org.apache.pdfbox.pdmodel.font.*; |
4 | import rst.pdfbox.layout.text.*; |
5 | import rst.pdfbox.layout.elements.*; |
6 | import rst.pdfbox.layout.elements.Document; |
7 | import rst.pdfbox.layout.util.*; |
8 | |
9 | lib 1400393 // pdfbox2-layout |
10 | lib 1400391 // pdfbox |
11 | lib 1400394 // fontbox |
12 | lib 1400355 // commons logging |
13 | |
14 | cprint { |
15 | start-thread { |
16 | Document document = new(Constants.A4, 40, 60, 40, 60); |
17 | |
18 | new Paragraph title; |
19 | title.addMarkup("*This is a header*", 30, BaseFont.Times); |
20 | document.add(title); |
21 | document.add(new VerticalSpacer(5)); |
22 | |
23 | new Paragraph paragraph; |
24 | paragraph.addText(repString("Hello World. ", 100), 20, PDType1Font.HELVETICA); |
25 | document.add(paragraph); |
26 | |
27 | S bulletOdd = CompatibilityHelper.getBulletCharacter(1) + " "; |
28 | |
29 | paragraph = new Paragraph; |
30 | paragraph.add(new Indent(bulletOdd, 4, SpaceUnit.em, 11, |
31 | PDType1Font.TIMES_BOLD, Alignment.Right)); |
32 | paragraph.addMarkup("This is a list item\n", 11, BaseFont.Times); |
33 | paragraph.add(new Indent(bulletOdd, 4, SpaceUnit.em, 11, |
34 | PDType1Font.TIMES_BOLD, Alignment.Right)); |
35 | paragraph.addMarkup("Another list item\n", 11, BaseFont.Times); |
36 | document.add(paragraph); |
37 | |
38 | File f = prepareProgramFile("test1.pdf"); |
39 | { |
40 | temp OutputStream outputStream = newFileOutputStream(f); |
41 | document.save(outputStream); |
42 | } |
43 | printFileInfo(f); |
44 | } |
45 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028292 |
Snippet name: | Test PDFBox-Layout [dev.] |
Eternal ID of this version: | #1028292/15 |
Text MD5: | c588a72ee6756a88a60fe98ef9a2f44b |
Transpilation MD5: | d4f8f222e1b6394cf8767246824ff5af |
Author: | stefan |
Category: | javax / pdf |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-06-09 18:46:26 |
Source code size: | 1415 bytes / 45 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 257 / 617 |
Version history: | 14 change(s) |
Referenced in: | [show references] |