20 March 2017
Could you please clarify whether that 500 page PDF document is actually a single 500-page document, or rather multiple smaller documents?
Information about pages, including the information stored in temporary files, is used on each processing step. Having information about all pages is especially important during the document synthesis stage when separate pages are combined into a single document. Therefore, deleting temporary files would cause issues.
Now, if you are dealing with 500-page documents, you could try to set the value of the IFRDocument::PageFlushingPolicy property to PFP_KeepInMemory. This should reduce the amount of data stored in the temporary folder.
If, on the other hand, you are dealing with multiple documents stored in a single file, you could process them one by one. First, use the IFRDocument::AddImageFile() method to add pages corresponding to a single document (the PageIndices parameter of the method can be used to add only the specified pages of the source document to the FRDocument object). Then, process and export the document, e.g. by calling IFRDocument::Process() and IFRDocument::Export(). Finally, call the IFRDocument::Close() method to releases all resources used by the FRDocument objects, including the temporary files. Repeat these steps for all documents contained in the source PDF file.