Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


The function writes the pages in memory to the PDF file.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 3.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.FlushPages"; PDF { ; Flags } )   More


Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
Flags A combination of the flag values.
Default is 0.
0 Optional


Returns OK or error message.


The function writes the pages in memory to the PDF file.
The function can be called every time a new page was created or whenever the pages in memory are no longer required.
Calling the function on a memory based PDF file is not meaningful. The output file must already be open before the function can be called. If no output file was set in DynaPDF.New then open the output file with DynaPDF.OpenOutputFile beforehand.
Flushed pages can no longer be accessed with DynaPDF.EditPage but it is of course possible to add further pages to the file.
By default, the function writes the content streams of all pages and referenced templates, patterns, and images to the output file. The content streams of these objects will be released but the objects remain in memory. So, all handles remain valid and it is still possible to use already flushed objects in subsequent pages. For example, a flushed image or template can still be inserted in other pages with DynaPDF.PlaceImage or DynaPDF.PlaceTemplate because the content streams or image buffers are not required for this action.
The flag ImagesOnly can be used to flush the images in memory only. This can be useful if further objects must be added to the pages in memory or if a large image was inserted.
It is allowed to call the function within an open page. In this case the function does not flush the content stream of the current open page but anything else depending on the used flags.
Calling a function like DynaPDF.DeletePage, DynaPDF.DeleteField or any other function that deletes a flushed object results in a damaged PDF file.

Default0Write anything to the file that is possible
ImagesOnly1 If set, only images are written to the PDF file. All pages are still kept in memory and can be modified with DynaPDF.EditPage. Flushed images can still be referenced in other pages. The image handles remain valid.
ExclLastPage2If set, the last page is not flushed

See also FlushPages function in DynaPDF manual.


Do a flush:

MBS( "DynaPDF.FlushPages" )

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 14th July 2022

DynaPDF.FlattenForm - DynaPDF.FlushPagesEx