Skip to content

Commit 13c7d3d

Browse files
committed
N&N Entry for SWT PDF Support
1 parent 2b12ab1 commit 13c7d3d

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

news/4.39/platform_isv.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,42 @@ toolControl.getTags().remove(IPresentationEngine.NO_MOVE);
2727
```
2828

2929

30-
<!--
3130
---
3231
## SWT Changes
33-
-->
32+
33+
### Native PDF Output Support
34+
35+
<details>
36+
<summary>Contributors</summary>
37+
38+
- [Christoph Läubrich](https://github.com/laeubi)
39+
</details>
40+
41+
SWT now provides native PDF generation capabilities through a new `PDFDocument` class, enabling direct export of widget content to PDF files without requiring external libraries.
42+
43+
Applications can now export SWT widget content to PDF using the standard `Control.print(GC)` API with the familiar GC drawing operations, or create fully customized PDF documents programmatically.
44+
45+
#### Platform Support
46+
47+
| Platform | Implementation |
48+
|----------|----------------|
49+
| GTK (Linux) | Cairo PDF surface |
50+
| Cocoa (macOS) | Core Graphics CGPDFContext |
51+
| Win32 (Windows) | Microsoft Print to PDF |
52+
53+
#### Example Usage
54+
55+
```java
56+
// Create a PDF document
57+
PDFDocument pdf = new PDFDocument(display, "output.pdf", 595, 842); // A4 size in points
58+
59+
// Print a control to the PDF
60+
GC gc = new GC(pdf);
61+
control.print(gc);
62+
gc.dispose();
63+
64+
// Dispose the document when done
65+
pdf.dispose();
66+
```
67+
68+
This enhancement eliminates the need for external PDF libraries and provides a native, platform-integrated solution for PDF generation in SWT applications. See Snippet388 for a complete working example.

0 commit comments

Comments
 (0)