File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,31 @@ protected override void Dispose(bool disposing)
177
177
/// </summary>
178
178
internal virtual void Finish ( )
179
179
{
180
+ if ( _formState == FormState . NotATemplate || _formState == FormState . Finished )
181
+ return ;
182
+
183
+ if ( ! ( _formState == FormState . Created || _formState == FormState . UnderConstruction ) )
184
+ {
185
+ throw new InvalidOperationException ( "Expected the form to be Created or UnderConstruction" ) ;
186
+ }
187
+
188
+ _formState = FormState . Finished ;
189
+ Gfx . Dispose ( ) ;
190
+ Gfx = null ;
191
+
192
+ if ( PdfRenderer != null )
193
+ {
194
+ //pdfForm.CreateStream(PdfEncoders.RawEncoding.GetBytes(PdfRenderer.GetContent()));
195
+ PdfRenderer . Close ( ) ;
196
+
197
+ if ( _document . Options . CompressContentStreams )
198
+ {
199
+ _pdfForm . Stream . Value = Filtering . FlateDecode . Encode ( _pdfForm . Stream . Value , _document . Options . FlateEncodeMode ) ;
200
+ _pdfForm . Elements [ "/Filter" ] = new PdfName ( "/FlateDecode" ) ;
201
+ }
202
+ int length = _pdfForm . Stream . Length ;
203
+ _pdfForm . Elements . SetInteger ( "/Length" , length ) ;
204
+ }
180
205
}
181
206
182
207
/// <summary>
@@ -437,4 +462,4 @@ string IContentStream.GetFormName(XForm form)
437
462
internal XGraphicsPdfRenderer PdfRenderer ;
438
463
439
464
}
440
- }
465
+ }
You can’t perform that action at this time.
0 commit comments