CommandStrEx() to Save a file

  • PDFMem is defined as: TWPViewPDF;

    I use (with success in most cases) the following code:


    Result := GetATempFileWithExt(JSTempDir,sDotPDF);

    PDFMem.CommandStrEx( COMPDF_ACTIONNR, Result, 4); //FileSaveAsPDF (no prompt)

    Application.ProcessMessages;

    PDFMem.CommandStr( COMPDF_ACTION,'FileClose=Close');

    Application.ProcessMessages;

    with the call to GetATempFileWithExt() function, Result will be a filename, something similar to: c:\SomeTempDir\__TempFolder\temp1234.pdf

    This is simply a filename, not an actual file. We asked for a temporary filename that does not exist, so we can create it with the next call to PDFMem.CommandStr()

    Yes, this is a local file.

    This seems to fail, with the file not existing after a the call to both FPDFMem.CommandStrEX() and PDFMem.CommandStr() functions.

    PDFMem does not fail, but the expected new file was not created/saved.

    Suggestions? Can I get this to save in another method with better success?

    Thanks in Advance.