Bullzip codeunit differences in RTC

davmac1davmac1 Member Posts: 1,283
edited 2011-03-14 in NAV Three Tier
I have changed codeunit 82 to print without asking the file name and giving it the specific file name, plus setting it to merge documents.
It works fine in Classic, but in RTC, it ignores the settings in the codeunit and brings up the Bullzip prtinter box and asks for the filename and ignores my other commands to merge pdfs.
Is this a bug in the RTC?
Is there a workaround?

Comments

  • ara3nara3n Member Posts: 9,256
    why are you using bullzip in RTC? you should use MyReport.saveasPDF instead.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • davmac1davmac1 Member Posts: 1,283
    2 reasons:
    1) report is Classic being executed from RTC
    2) I need to merge other pdfs (scanned expenses saved as pdfs) into final document

    I could get the report developed for RTC (someone else did it, and I am strapped for time), but I would still need to merge the other pdfs which bullzip does beautifully.

    (Using your sample code plus someone else's plus some of my own, I have the sales invoice printing to bullzip, merging linked pdf documents, then saving the finished pdf as a linked document for the posted sales invoice (so they can keep an audit trail of signatures).
  • ara3nara3n Member Posts: 9,256
    If the report being executable is classic, then you could run your whole code in classic as well?

    Move all your code to a dummy report that doesn't have RTC Page section. Then run it. this will cause RTC to start classic client and your code probably will be on prereport and then at the end write something like.
    CurrReport.break.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • davmac1davmac1 Member Posts: 1,283
    Thanks for your help.
    I had to put it in a data item and then pur the break at the end of the code because I got an error on having a break in a prereport section.

    One other quirk - when I retrieved the file name from the record links, if it was a UNC name, I had to remove: "file://" from the beginning of the file name.

    for those interested, I added this line to codeunit 82:

    REPORT.RUN(REPORT::ProcessAndPrintSalesInvoices,FALSE,FALSE,SalesInvHeader);

    the final code in the custom report:


    IF ISCLEAR(BullZipPDF) THEN
    CREATE(BullZipPDF);

    //

    ReportSelection.RESET;
    ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Invoice");
    ReportSelection.FINDSET;

    //

    ReportID := ReportSelection."Report ID";

    FileDirectory := 'C:\Temp\';
    IF JobSetup.GET THEN
    IF JobSetup."UNC PDF Directory" <> '' THEN
    FileDirectory := JobSetup."UNC PDF Directory" + '\';

    Object.GET(Object.Type::Report,'',ReportID);
    SalesInvHeader.GET("Sales Invoice Header"."No.");
    SalesInvHeader.SETRECFILTER;

    FileName := SalesInvHeader."No." + '.pdf';
    BullZipPDF.Init;
    BullZipPDF.LoadSettings;
    RunOnceFile := BullZipPDF.GetSettingsFileName(TRUE);
    BullZipPDF.SetValue('Output',FileDirectory+FileName);
    BullZipPDF.SetValue('Showsettings', 'never');
    BullZipPDF.SetValue('ShowPDF', 'no');
    BullZipPDF.SetValue('ShowProgress', 'no');
    BullZipPDF.SetValue('ShowProgressFinished', 'no');
    BullZipPDF.SetValue('SuppressErrors', 'yes');
    BullZipPDF.SetValue('ConfirmOverwrite', 'no');
    IF SalesInvHeader.HASLINKS THEN BEGIN
    MergeFile:='';
    RecLinks.SETRANGE(RecLinks.Description,'Order: ' + SalesInvHeader."Pre-Assigned No.",
    'Order: ' + SalesInvHeader."Pre-Assigned No." + 'z');
    RecLinks.SETRANGE(Company,COMPANYNAME);
    RecLinks.FINDSET;
    REPEAT
    IF MergeFile = '' THEN
    MergeFile:='.|' + RecLinks.URL1
    ELSE
    IF COPYSTR(RecLinks.URL1,1,7) = 'file://' THEN
    MergeFile:='.|' + COPYSTR(RecLinks.URL1,8)
    ELSE
    MergeFile:='.|' + RecLinks.URL1;
    UNTIL RecLinks.NEXT = 0;
    BullZipPDF.SetValue('MergeFile', MergeFile);
    END;

    BullZipPDF.WriteSettings(TRUE);

    REPORT.RUNMODAL(ReportSelection."Report ID",FALSE,FALSE,SalesInvHeader);
    BullZipPDF.WriteSettings(TRUE);

    TimeOut := 0;
    WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN
    SLEEP(1000);
    TimeOut := TimeOut + 1;
    END;

    SalesInvHeader.ADDLINK(FileDirectory+FileName,'Sales Invoice: ' + SalesInvHeader."No.");


    CurrReport.BREAK;
  • cparogercparoger Member Posts: 1
    Rashad,

    I am using the Lanham E-Mail add-on in NAV2009SP1 to send Standard NAV Reports ast PDF attachments. In NAV5.1, we used the Bullzip PDF Printer to send out the E-Mails with PDF attachments. Now it appears that either PDFCreator or Bullzip will work in NAV2009Sp1, but you seem to prefer Bullzip.

    I have tried to read all the posts on this topic but I cannot find the solution to registering the Bullzip or PDF Creator Automation Objects in NAV2009 on a 64 bit Server 2003 Server running Terminal Services. I also am unable to register the controls in NAV2009SP1 installed on Windows 7 Ultimate. Lanham provides codeunit 14000716 PDF Management - when I attempt to compile this, I get an error that NAV Cannot Load the selected type library - Unknown Automation Server.Server Class.

    I have installed the latest Bullzip and PDF Creator software and printers but no OCX files were installed so I do not see how to register these in Tools --> Custom Controls.

    Any help is appreciated as I ](*,).

    Is either BullZip or PDFCreator capable of being used to add PDF Attachments for Standard NAV Reports to Lanham Email generated in NAV2009SP1? If so, can you provide more guidance as to how to instantiate the Automation Objects to run from an RTC session?
  • ara3nara3n Member Posts: 9,256
    The object lanham sent you probably references the old version PDFCreator. design the codeunit and reselect the automation.

    do this in xp to make sure it's not a 64 bit issue. Then let me know if you still have an issue.

    When you install pdfcreator or bullzip, it automatically registers the dll.

    I've just tested bullzip on windows 7 64 bit and have no issues instantiating it.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.