can pdfCreator create/save pdf by sales invoice no.

teckpohteckpoh Member Posts: 271
Hi Experts,

Can pdfCreator save my report to pdf file by sales inv no?
Example:
When i print "Sales Inv" rpt and filtered by inv no: 1000..3000
and i expect pdfCreator to create and save 3 individual reports which like 1000.pdf, 2000.pdf and 3000.pdf.
Unfortunately at the moment pdfCreator save all records that belong to inv no 1000..3000 into a single pdf file.

How to implement tis??
Below is my coding:

IF ISCLEAR(PDFCreator) THEN
CREATE(PDFCreator);
IF ISCLEAR(PDFCreatorError) THEN
CREATE(PDFCreatorError);

filedir := 'C:\sentbox';
filename := "Sales Invoice Header"."No."+'.pdf';
PDFCreatorError := PDFCreator.cError;

IF PDFCreator.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN
ERROR('Status: Error: ' + PDFCreatorError.Description);

PDFCreatorOption := PDFCreator.cOptions;


PDFCreatorOption.AutosaveDirectory := filedir;
PDFCreatorOption.AutosaveFilename := filename;
PDFCreatorOption.UseAutosave := 1;
PDFCreatorOption.UseAutosaveDirectory := 1;
PDFCreatorOption.AutosaveFormat := 0;


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

Thank in advace~~

Answers

  • kinekine Member Posts: 12,562
    You need to call the report for each invoice as seaparate report. Filter record over the invoices and call the report in a loop (filter for the specific no. before calling the report) with just changing PDF name.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • teckpohteckpoh Member Posts: 271
    Dear Kine,

    If i call each invoice in a separate report i wonder how i'm gotta to specify the filtering? User might need to enter the filtering "date", "invoice no" in the report itself.
  • kinekine Member Posts: 12,562
    Ah, ok, than you can have one report, which just read the filters, and instead printing will just run the real printing report in a loop for each header in the filter range...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • teckpohteckpoh Member Posts: 271
    Instead of do it by 2 rpt is it possible to write code and doing some control inside a report with pdfCreator method/property?
  • kinekine Member Posts: 12,562
    No, it is not possible, because printing one report is one print job and you cannot divide it into more files.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • teckpohteckpoh Member Posts: 271
    Dear Kine,

    Thank YOU VERY MUCH~~~ UR APPROACH WORKED WELL~~~~!!!!!!!!
  • kinekine Member Posts: 12,562
    You are welcome.

    Please, add prefix [solved] into subject of your first post in this thread...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.