Options

How to know whether Navision report is saved in pdf format

pushpraj1008pushpraj1008 Member Posts: 33
Hi,

I'm using PDF creator for saving navision report in PDF format through Navision Form.
I want to display a message with filename if the Navision report has saved in pdf format.

How would we know whether report is saved in PDF format or not.
Regards
Pushpraj

Comments

  • Options
    garakgarak Member Posts: 3,263
    take a look into the folder where the pdf should created
    Do you make it right, it works too!
  • Options
    pushpraj1008pushpraj1008 Member Posts: 33
    Hi,

    I want to know display a message whether report is saved in pdf format or not.
    Is any way in the from when it is report is running through report.runmodel.

    Below is the code:


    PDFCreatorOption := PDFCreator.cOptions;
    PDFCreatorOption.UseAutosave := 1;
    PDFCreatorOption.UseAutosaveDirectory := 1;
    PDFCreatorOption.AutosaveDirectory := FileDirectory;
    PDFCreatorOption.AutosaveFormat := 0; //PDF file, you can also save in other formats
    PDFCreatorOption.AutosaveFilename := FileName;

    PDFCreator.cOptions := PDFCreatorOption;
    PDFCreator.cClearCache();
    DefaultPrinter := PDFCreator.cDefaultPrinter;
    PDFCreator.cDefaultPrinter := 'PDFCreator';
    PDFCreator.cPrinterStop := FALSE;

    IF vInvoiceNo<>'' THEN BEGIN
    lRecSalesInvHead.SETRANGE(lRecSalesInvHead."No.",vInvoiceNo);
    REPORT.RUNMODAL(ReportID,FALSE,TRUE,lRecSalesInvHead);
    END ELSE
    REPORT.RUNMODAL(ReportID,BlnReqFrm,TRUE);

    IF Exits(FileDirectory+FileName+'.pdf' then
    MESSAGE('File %1 created',FileName);

    but this is not working. This code on "onPush' of button from a NAV Form.
    Regards
    Pushpraj
  • Options
    matttraxmatttrax Member Posts: 2,309
    Sometimes the file is not generated / not seen by the file system immediately after it is created. The code that checks to see if it exists will fail.

    Try putting the check in a loop with a timer. ie look for the file, if you don't find it, wait 1 second, check again. Do that for 5 checks or until it is found.
  • Options
    garakgarak Member Posts: 3,263
    Why do you not put the message in the report self in OnPostReport() :?:

    If you only need the message sometimes on special steps you create a function in the Report where you set a BoolVar if the message should displayed.

    The Report you declare as variable and runs this VariableReport.

    Read this LINK and there my post.
    There is an example.

    Regards
    Do you make it right, it works too!
  • Options
    David_SingletonDavid_Singleton Member Posts: 5,479
    Try something like
    // PDFFile var of type FILE
    Window.open('@1@@@@@@@@@');
    REPEAT
    counter += 1;
    window.update(1,counter);
    UNTIL PDFFile.OPEN(PDFDir + '\' + PDFFile) OR (Counter > 10000);
    

    From this post:

    http://www.mibuso.com/forum/viewtopic.php?f=23&t=21157
    David Singleton
  • Options
    SavatageSavatage Member Posts: 7,142
    Also on the PDF Creator Options you can check off autosave options - open pdf once created.

    Or in the Actions option you can tell it to give you a pop up message.
    see here:
Sign In or Register to comment.