@@ -23,6 +23,15 @@ public struct PDFDocument {
2323
2424}
2525
26+ // MARK: Default page size for result builders
27+
28+ private extension PDFDocument {
29+
30+ /// The default size used for pages implicitly created from views.
31+ static let defaultPageSize : PageSize = DIN . a4
32+
33+ }
34+
2635// MARK: - PDFPagesBuilder
2736
2837@resultBuilder
@@ -42,15 +51,21 @@ public enum PDFPagesBuilder {
4251 }
4352
4453 public static func buildPartialBlock( first: some View ) -> [ PDFPage < AnyView > ] {
45- [ PDFPage ( erasing: first) ]
54+ [ PDFPage (
55+ size: PDFDocument . defaultPageSize,
56+ erasing: first
57+ ) ]
4658 }
4759
4860 public static func buildPartialBlock(
4961 accumulated: [ PDFPage < AnyView > ] ,
5062 next: some View
5163 ) -> [ PDFPage < AnyView > ] {
5264 var pages = accumulated
53- pages. append ( PDFPage ( erasing: next) )
65+ pages. append ( PDFPage (
66+ size: PDFDocument . defaultPageSize,
67+ erasing: next
68+ ) )
5469 return pages
5570 }
5671
@@ -73,15 +88,18 @@ public enum PDFDocumentBuilder {
7388
7489 public static func buildPartialBlock( first: some View ) -> PDFDocument {
7590 PDFDocument {
76- PDFPage {
91+ PDFPage ( size : PDFDocument . defaultPageSize ) {
7792 first
7893 }
7994 }
8095 }
8196
8297 public static func buildPartialBlock( accumulated: PDFDocument , next: some View ) -> PDFDocument {
8398 var pages = accumulated. pages
84- pages. append ( PDFPage ( erasing: next) )
99+ pages. append ( PDFPage (
100+ size: PDFDocument . defaultPageSize,
101+ erasing: next
102+ ) )
85103 return PDFDocument ( pages: pages)
86104 }
87105
0 commit comments