DynaPDF Manual - Page 329

Previous Page 328   Index   Next Page 330

Function Reference
Page 329 of 787
SI32 pdfFlushPageContent(
const PPDF* IPDF,
// Instance pointer
struct TPDFStack* Stack) // Operation stack
The function replaces the content stream of a page or template that was changed with the function
ReplacePageText() or ReplacePageTextEx() beforehand.
The function must be called after all changes are made. See GetPageText() for an example
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
LBOOL pdfFlushPages(
const PPDF* IPDF,
// Instance pointer
TFlushPageFlags Flags) // see below
typedef enum
= 0, // Write anything to the file that is possible
= 1, // If set, only images are written to the PDF
// file. All pages are still kept in memory and
// can be modified with EditPage(). Flushed images
// can still be referenced in other pages. The
// image handles remain valid.
fpfExclLastPage = 2
// If set, the last page is not flushed
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 CreateNewPDF() then open the
output file with OpenOutputFile() or OpenOutputFileEncrypted() beforehand. The latter one can be
used to create an encrypted PDF file.
Flushed pages can no longer be accessed with 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 PlaceImage() or PlaceTemplate() because the content streams or image buffers are not required
for this action.

Previous topic: FlattenForm

Next topic: FlushPagesEx, FreeImageBuffer, FreeImageObj

Start Chat