Options

PDF document and Blob field - NAV 2016

rnjbngrnjbng Member Posts: 82
Hi Folks -

I have created a processing report to run through the customer table and save a report as .PDF and then email the .PDF document. Everything works fine, email is sent and attachment is there but when you open the .PDF when email is received, it says cannot load file basically it has 0 bytes. Nothing is written to the blob file. Below is the code.

tempblob.blob.createoutstream(outstr);

FileName := SMTPSetup."Save PDF Report"+'Statement' + CustRecNew."No." + '.PDF';
Saved := REPORT.SAVEASPDF(50183,FileName,CustRecNew);

ServerFileName := FileMgt.UploadFileSilent(FileName);

FileMgt.BLOBExportToServerFile(Tempblob,FileName);

Can someone please help me out here. Any help is truly appreciated.

Thanks
RJ.

Comments

  • Options
    JuhlJuhl Member Posts: 724
    No need to upload. And you never fill TempBlob
    Follow me on my blog juhl.blog
  • Options
    TallyHoTallyHo Member Posts: 383
    edited 2018-11-15
    tempblob.blob.createoutstream(outstr);
    RecRef.GETTABLE(CustRecNew);
    RecRef.SETRECFILTER;
    REPORT.SAVEAS(REPORT::"50183",'',REPORTFORMAT::Pdf,OutStr,RecRef);
    (or leave the recref, if report loops all customers)
    tempblob.Blob.CREATEINSTREAM(Instr);
    smtpmail.AddAttachmentStream(Instr,CustRecNew."No."+'.PDF');
Sign In or Register to comment.