Pages

Monday, December 3, 2018

Printing Documents to PDF from NAV / Business Central

👋 Hi all,

This article am writing on the request of @Akash, It's already published by Bullzip, here am going to describe step by step for new developer who is still bothering How to set password, Digital signature, Watermark e.t.c on PDF Documents.
This is an example of how to use the PDF Printer from Microsoft Dynamics NAV / business Central (on premise).
I will use the C/AL code to show you a couple of thing that you can do from NAV. These subjects are covered by the example.

  • Printing multiple documents in a loop.
  • Using a watermark with dynamic text.
  • Signing the PDF using a digital certificate.
  • Sending Documents to Customer over Email.
  • Error handling



Step - 1:
     Download the BulllZip Printer and install in Server & Client Computer.
Step - 2:
    open NAV Development and make the below changes in standard objects to write the business logic to achieve the goals.
As per my demo i have already customized some standard objects, you can also modify your standard objects.
  • Table 18 Customer : Add a "Document Password" field to store the Customer document's  password.
  • Table 311 "Sales & Receivables Setup" : Add the below fields
  1. Payment Slip File Path Text 250
  2. Payment Slip History Path Text 250
  3. Master Password Text 30
  4. eSign Certificate Path Text 250
  5. eSign Password Text 30
  6. PDF Write Delay (seconds) Integer
  7. Email PDFs         Boolean
  8. Move PDFs after Emailing Boolean
  9. Delete PDFs after Emailing Boolean

Step - 3:
    Setup the data in below Tables
  1. 18 Customer
  2. 311 Sales & Receivables Setup
  3. 78 Printer selection
  4. 409 SMTP Mail Setp
Step - 4:
    Create a Certificate (this is mandatory if you would like to add digital signature in your documents).
You can create Test Certificate free from below link.

Step - 5:
    Create a new Codeunit as per my demo  i have created 50000 Business Logic and write code / functions to achieve the aims that we discussed earlier.

follow the below screenshots


















you can download business Logic Codeunit from here, BC Objects


3 comments:

  1. Hi Any Possibility to share example for Business Central cloud ?

    ReplyDelete
  2. Hi can u share the all setups which u mentioned

    ReplyDelete
  3. Hi,
    I tried this but i am getting question mark.. instead of Tick mark also it's coming signature not verified.

    ReplyDelete