PDF document and Blob field - NAV 2016

rnjbngrnjbng Posts: 69Member
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

  • JuhlJuhl Posts: 591Member
    No need to upload. And you never fill TempBlob
    Follow me on my blog juhl.blog
  • TallyHoTallyHo Posts: 37Member
    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');
    I'm not confused. I'm just well mixed.
Sign In or Register to comment.