Getting error during sending PDF invoice attachement using bullzip pdf printer.

Hi Everyone,

I am sending PDF invoice attachment through mail through Bullzip PDF printer.
1. when i am trying in server, its working fine. but
2. when client is sending from his local machine its showing error.
Sometimes its showing:
Error:1.

dubjs0jllseq.png

1. I have created shared path in server side and gave full permission to the user who is testing it.
2. I have installed Bullzip also in client side.


Error:2.

brykt7obvbv9.png


For the above requirement I am using this link as reference:
https://saurav-nav.blogspot.com/2013/08/navision-classic-save-report-in-pdf.html

Below is my code:
1.For creating PDF file:

CreatePDFfile(SalesInvHeader : Record "Sales Invoice Header")

lSalesInvHdr.RESET;
lSalesInvHdr.SETRANGE("No.",SalesInvHeader."No.");
IF lSalesInvHdr.FINDFIRST THEN
IF ISCLEAR (BullZip) THEN
CREATE(BullZip);
year := DATE2DMY(TODAY, 3);
FileName1:='\\10.10.1.21\Temp\' +lSalesInvHdr."No." + '-'+FORMAT(TODAY,0,'<day,2>-<month,2>')+'-'+FORMAT(year)+
FORMAT(TIME,0,'<hour, 2>.<minute,2>.<second,2>')+'-'+'.pdf';
BullZip.Init;
BullZip.LoadSettings;
RunOnceFile:=BullZip.GetSettingsFileName(TRUE);
BullZip.SetValue('Output',FileName1);
BullZip.SetValue('Showsettings','never');
BullZip.SetValue('ShowPDF','no');
BullZip.SetValue(' ShowProgress','no');
BullZip.SetValue(' ShowProgressFinished','no');
BullZip.SetValue('SuppressErrors','yes');
BullZip.SetValue('ConfirmOverWrite','no');
BullZip.WriteSettings(TRUE);
SalesReport.SETTABLEVIEW(lSalesInvHdr);
SalesReport.USEREQUESTFORM(FALSE);
SalesReport.RUNMODAL;
CLEAR(BullZip);
SendMail(lSalesInvHdr."Sell-to Customer No.",FileName1);
ERASE(FileName1);

2. For sending mail with PDF attachment:

SendMail(VAR CUstNo : Code[30];path : Text[250])
Customer.GET(CUstNo);
SMTPSetup.GET;
Customer.TESTFIELD("E-Mail");
SMTPMAil.CreateMessage(SMTPSetup."Send Email Name",SMTPSetup."Email Sender Email",Customer."E-Mail",'Posted Sale Invoice',' ',TRUE);
SMTPMAil.AddCC(Customer."E-Mail");
SLEEP(2*1000);
SMTPMAil.AddAttachment(path);
SMTPMAil.Send;


SO, once more i want to ensure that i am not getting any error from server side(its working fine. ie end user is getting pdf in mail), when client is trying from his local machine then only the above mentioned error is coming.


Please help me regarding this query/issue, i am facing this issue from long time. it will be very very appreciable to help me.
please suggest/guide me, where i am doing wrong or what is missing.

Thanks in Advance;
Mani.

Answers

  • ManiNavManiNav Member Posts: 120
    Hi Everyone,

    please suggest me for the above query. it will be very useful for me.....

    Thanks,
    Mani.
  • waitwait Member Posts: 53
    Is it possible the attachment has not been created when you try to send the mail?

    Instead of SLEEP(2*1000) you could try to loop until the the attachment exists.

    What version of NAV are you using?
  • ManiNavManiNav Member Posts: 120
    Hi wait,

    I am using NAV 2009 R2.
    Its working fine in server side, PDF is generating and attachment is able to send But issue is generating from client local machine side.

    Please guide me, why client is facing the above issue when they are trying from his local machine.Even that particular user has the full permission for that shared path.

    Thanks,
    Mani.
  • waitwait Member Posts: 53
    Does the pdf get created when running from the client side?
  • ManiNavManiNav Member Posts: 120
    Hi wait,

    No,pdf is not created on specific path but message is showing as its generating each time with name(file name) as its showing in first error.

    what is the reason, because each and every time its showing with different name as you can see in file name i have added invoice no with date time.

    please guide me.

    Thanks,
    Mani.
  • ManiNavManiNav Member Posts: 120
    Hi Everyone/wait,

    I am waiting for response to resolve the above issue.
    Please suggest me..

    Thanks,
    Mani.
  • lubostlubost Member Posts: 611
    Probably access problem. You probably using RTC client, because classic client does not have server/client side. If you do with files in RTC, you should download/upload files to/from server. Bullzip should have write access to share.
  • ManiNavManiNav Member Posts: 120
    Hi lubost,

    I am using classic client only.[2009 R2]
    I mean to say that client is trying with his own local machine then they are facing the above issue; if they are trying in server side then its working fine.

    Thanks,
    Mani.
  • waitwait Member Posts: 53
    I did a lot of work with Bullzip and email's some years ago, then I created the PDF in a temp folder on the client machine and cleaned it up when I had sent it. Is it some specific reason you want to store this on the shared path?
  • ManiNavManiNav Member Posts: 120
    Hi wait,

    I am not storing pdf file in shared path, i am generating,sending and cleaned. The reason behind to give shared path in server side to access that file from anywhere ie Either server side or from client's local machine. But, i am not able to clear why from local machine not able to generate.(Or, i mean facing above issue)

    As you work alot with bullzip and emails. so, i am requesting you to see once my code please.. and guide me where i am doing wrong.[or, you need more info from my side?]
    please guide me.{I am hoping with help of you i can resolve this issue}

    Thanks,
    Mani.
  • lubostlubost Member Posts: 611
    Your code sets the BullZip to create file somewhere outside local machine. Let the BullZip to create PDF somewhere locally, send PDF and then copy PDF to shared folder.
  • ManiNavManiNav Member Posts: 120
    Hi lubost,

    I tried already with TEMPORARYPATH instead of server shared path, but its not working. Same issue i was facing. And i don't need to save that generated file to shared path, i am using above shared path to access from anywhere.

    Thanks,
    Mani.
  • ManiNavManiNav Member Posts: 120
    Hi Everyone,

    Please guide me further regarding above issue.

    Thanks,
    Mani.
  • ManiNavManiNav Member Posts: 120
    Hi Everyone,

    I am waiting for the response to resolve this issue; please.....

    Thanks,
    Mani.
  • garnilsengarnilsen Member Posts: 1
    Any luck on resolving this issue. We are running into the same problem.
  • waitwait Member Posts: 53
    One question, if you try to write the pdf to c:\temp\ does the file get created?
Sign In or Register to comment.