@@ -33,22 +33,135 @@ var doc: PDFKit.PDFDocument = new PDFDocument({
3333 fontLayoutCache : true ,
3434} ) ;
3535
36+ // $ExpectType PDFDocument
37+ doc . addPage ( ) ;
38+ // $ExpectType PDFDocument
39+ doc . addPage ( { } ) ;
40+ // $ExpectType PDFDocument
3641doc . addPage ( {
37- margin : 50 ,
42+ compress : true ,
43+ info : {
44+ Title : "Sample PDF" ,
45+ Author : "John Doe" ,
46+ Subject : "Testing" ,
47+ Keywords : "typescript, pdf, test" ,
48+ } ,
49+ userPassword : "user123" ,
50+ ownerPassword : "owner456" ,
51+ permissions : {
52+ printing : "highResolution" ,
53+ modifying : false ,
54+ copying : true ,
55+ annotating : true ,
56+ fillingForms : false ,
57+ contentAccessibility : true ,
58+ documentAssembly : false ,
59+ } ,
60+ pdfVersion : "1.7" ,
61+ autoFirstPage : false ,
62+ size : [ 595.28 , 841.89 ] ,
63+ margin : 10 ,
64+ margins : { top : 20 , left : 20 , bottom : 20 , right : 20 } ,
65+ layout : "portrait" ,
66+ font : "Helvetica" ,
67+ bufferPages : true ,
68+ tagged : true ,
69+ lang : "en-US" ,
70+ displayTitle : true ,
71+ subset : "PDF/A-1" ,
72+ fontLayoutCache : false ,
3873} ) ;
3974
40- doc . addPage ( {
41- margins : {
42- top : 50 ,
43- bottom : 50 ,
44- left : 72 ,
45- right : 72 ,
75+ // $ExpectType PDFDocument
76+ doc . continueOnNewPage ( ) ;
77+ // $ExpectType PDFDocument
78+ doc . continueOnNewPage ( { } ) ;
79+ // $ExpectType PDFDocument
80+ doc . continueOnNewPage ( {
81+ compress : true ,
82+ info : {
83+ Title : "Sample PDF" ,
84+ Author : "John Doe" ,
85+ Subject : "Testing" ,
86+ Keywords : "typescript, pdf, test" ,
4687 } ,
88+ userPassword : "user123" ,
89+ ownerPassword : "owner456" ,
90+ permissions : {
91+ printing : "highResolution" ,
92+ modifying : false ,
93+ copying : true ,
94+ annotating : true ,
95+ fillingForms : false ,
96+ contentAccessibility : true ,
97+ documentAssembly : false ,
98+ } ,
99+ pdfVersion : "1.7" ,
100+ autoFirstPage : false ,
101+ size : [ 595.28 , 841.89 ] ,
102+ margin : 10 ,
103+ margins : { top : 20 , left : 20 , bottom : 20 , right : 20 } ,
104+ layout : "portrait" ,
105+ font : "Helvetica" ,
106+ bufferPages : true ,
107+ tagged : true ,
108+ lang : "en-US" ,
109+ displayTitle : true ,
110+ subset : "PDF/A-1" ,
111+ fontLayoutCache : false ,
47112} ) ;
48113
49- doc . addPage ( {
50- layout : "landscape" ,
51- } ) ;
114+ // $ExpectType { start: number; count: number; }
115+ doc . bufferedPageRange ( ) ;
116+
117+ // $ExpectType PDFPage
118+ doc . switchToPage ( ) ;
119+ // $ExpectType PDFPage
120+ doc . switchToPage ( 2 ) ;
121+
122+ // $ExpectType void
123+ doc . flushPages ( ) ;
124+
125+ // $ExpectType void
126+ doc . addNamedDestination ( "name" ) ;
127+ // $ExpectType void
128+ doc . addNamedDestination ( "name" , "Fit" ) ;
129+ // $ExpectType void
130+ doc . addNamedDestination ( "name" , "FitB" ) ;
131+ // $ExpectType void
132+ doc . addNamedDestination ( "name" , "FitBH" , 10 ) ;
133+ // $ExpectType void
134+ doc . addNamedDestination ( "name" , "FitBV" , 10 ) ;
135+ // $ExpectType void
136+ doc . addNamedDestination ( "name" , "FitH" , 10 ) ;
137+ // $ExpectType void
138+ doc . addNamedDestination ( "name" , "FitR" , 10 , 20 , 30 , 40 ) ;
139+ // $ExpectType void
140+ doc . addNamedDestination ( "name" , "FitV" , 10 ) ;
141+ // $ExpectType void
142+ doc . addNamedDestination ( "name" , "XYZ" , 10 , 20 , 30 ) ;
143+ // Test the "default" overload
144+ // $ExpectType void
145+ doc . addNamedDestination ( "name" , Math . random ( ) < 0.5 ? "XYZ" : "Fit" , 10 , 20 ) ;
146+
147+ declare let ref : PDFKit . PDFKitReference ;
148+ // $ExpectType void
149+ doc . addNamedEmbeddedFile ( "name" , ref ) ;
150+
151+ // $ExpectType void
152+ doc . addNamedJavaScript ( "name" , "let it = 'some js script';" ) ;
153+
154+ // $ExpectType PDFKitReference
155+ doc . ref ( { } ) ;
156+
157+ // $ExpectType PDFDocument
158+ doc . addContent ( { } ) ;
159+
160+ // $ExpectType void
161+ doc . end ( ) ;
162+
163+ // $ExpectType string
164+ doc . toString ( ) ;
52165
53166doc . info . Title = "Sample" ;
54167doc . info . Author = "kila Mogrosso" ;
0 commit comments