DynaPDF Manual - Page 798

Previous Page 797   Index   Next Page 799

Function Reference
Page 798 of 839
SetUseGlobalImpFiles
Syntax:
LBOOL pdfSetUseGlobalImpFiles(
const PPDF* IPDF, // Instance pointer
LBOOL Value)
// True or false
The property can be used to load one or more external PDF files permanent into memory, e.g. to
split a large PDF file into smaller pieces. The next PDF file that will be opened with the function
OpenImportFile() or OpenImportBuffer() will not be closed when CloseFile() or FreePDF() is called.
When creating a new PDF file the previously opened import file is still open and it is possible to
import pages from this file without loading the file again.
If more than one file should be loaded permanent into memory then set also the flag if2UseProxy
with SetImportFlags2(). PDF files which are no longer needed can be closed with CloseImportFile()
or CloseImportFileEx().
Return values:
This function cannot fail, the return value is always 1.
Example (Delphi):
In this example we have a large PDF file that should be splitted into separate files which should
contain one page each.
If we would not use the property UseGlobalImpFiles we must read the entire file structure each time a
page was extracted because the import file would be closed when CloseFile() is called. Splitting a
large file in this way would be extremely slow. To improve processing speed we set the property
UseGlobalImpFiles to true so that we must open the import file only one time.
// This is our error callback function
function ErrProc(const Data: Pointer; ErrCode: Integer; const ErrMessage:
PAnsiChar; ErrType: Integer): Integer; stdcall;
var s: String;
begin
s := ErrMessage + #13#13'Abort processing?';
if MessageDlg(s, mtError, [mbYes, mbNo], 0) = mrYes then
Result := 1
else
Result := 0;
end;
procedure TForm1.Button2Click(Sender: TObject);
var pdf: TPDF; i: Integer;
begin
pdf := nil;
try
pdf := TPDF.Create;
pdf.SetOnErrorProc(nil, @ErrProc);
 

Previous topic: SetTrapped, SetUseExactPwd

Next topic: SetUseImageInterpolation