Select different printers for report

Christian_BuehlChristian_Buehl Member Posts: 145
edited 2013-06-06 in Navision Financials
Does anyone know, how to manipulate the target printer.
The printerselection allows only to set alway the same printer for a report.
I want to choose between a pdf-printer and the regular printer.
As the printer is set in codeunit 1 there should be a way to select the printer dynamic (controlled by software).

Does anyone know how ?

Comments

  • Christian_BuehlChristian_Buehl Member Posts: 145
    As I think someone else is interested in a solution for this - I found a small (litttle bit dirty :P ) workaround for my problem, after I analyzed the ne-printer solution from BGI:
    I insert a new record into the printerselection, print the record and remove it after the record was printed.
    PrinterSelection | Record | table 78
    printer | record | table 2000000039 
    reporitid | Integer | number of report to print
    PDFPrintername | text 100 | Name of the Printer without ",NEx"
    --
    
    printer.SETFILTER(Name,PDFPrintername);
    IF NOT printer.FIND('-') THEN 
       ERROR('Printer %1 is not available\Please install first!', PDFPrintername);
    
    // First check if printer exist and delete if there is a preselection
    IF PrinterSelection.GET(USERID, reportid) THEN PrinterSelection.DELETE;
    PrinterSelection.INIT;
    PrinterSelection."Report ID" := reportid;
    PrinterSelection."UserID" := USERID;
    PrinterSelection.Printername := STRSUBSTNO('%1,%2',printer.Name,printer.device);
    PrinterSelection.INSERT;
    printdata.RESET;
    printdata.SETFILTER(printdata."Nr.",Rec."Nr.");
    REPORT.RUNMODAL(REPORT::Einkaufsbestellung ,FALSE,FALSE, printdata);
    PrinterSelection.DELETE;  
    
  • vandangvandang Member Posts: 101
    Thanks for your code, it helped me much ;)
Sign In or Register to comment.