Convert to PDF, Development Tips, How To, Information, Tip & Tricks

Merging PDF Files in Navision

Many of time we have multiple files in pdf but for some certain reasons we require to merge them to single File.

Continuing from my previous post i am extending my functionality with Merging of Mulitiple pdf files to single pdf file.

PDFConvMerge-2-2

In my Setup Page created in previous post i have added one more field to store the Tool Path & File Name for Merging multiple files.

Based on the dll provided by http://www.pdfsharp.net this post is written.

Visit the Site download the utility and extract the dll file and exe file from the zip and store in same Folder.

The format of command to merge the files at command prompt is similar to:

Command to merge :- pdfmerge output=.\ActionFolder\result.pdf input=.\ActionFolder\1.pdf,.\ActionFolder\2.pdf,.\ActionFolder\3.pdf

We will prepare the Function which will take as parameter the Output & Input File and run the utility to Merge these files to single file using WsShell in Navision.

PDFConvMerge-4

Function is very simple to accept the Input & Output File Names and Prepare Single PDF file from multiple pdf files provided as input (comma seperated List of Files) to the function.

To keep it simple no additional codes for test and other routine job is not added. Now you are familiar with the functionality you can tweak the code accordingly to meet all other requirements.

Thats all for this post. Will comeup with more Information in my upcoming posts.

Till then keep exploring and learning.

 

 

Advertisement
Convert to PDF, Development Tips, How To, Information, Office Integration, Tip & Tricks, Word

Converting Office Files into PDF from Navision

Today in this post i will walkthrough how we can convert any MS Office File into PDF.

It have been many time required to convert any attached file with the record in Navision to PDF format.

To perform this action we will require a tool which can be downloaded from:

OfficeToPDF download link :- http://officetopdf.codeplex.com/releases/view/118190

Extract and save the OfficeToPDF.exe file to some Folder.

For this Walkthrough i have created a Field in Customer Table to save the File Path of the Office File which we want to convert into PDF.

PDFConvMerge-1

You can add Dialog box to select the File from the specified Folder.

For this demo i have kept it simple Text Field where you can add your File Path and Office File Name. It is assumed that only Office File will be attached here.

For Setup purpose i have created one Setup Table & Page where we will store our other required Folder paths.

PDFConvMerge-2

Here we have given provision to save the Path of the Office to PDF Convertor Tool file Path & Temporay working Folder.

I have used the shared folder for all the paths so that it is not system specific, also make sure you give required permission on this folder for all the operating accounts.

Now our Next task will be to write a function which will perform this conversion part.

PDFConvMerge-3

Above Function Takes the File Name from the Customer Card we stored above on Customer Card. Takes the Path of the Office To PDF Convertor Utility and Tmp working Folder.

Prepares the PDF file Name along with Path stored in Setup.

Prepares the command to invoke Convert Utility using WsShell and returns the PDF file File Name along with path as defined in the Setup.

Now you can use this File for futher purpose as required.

To keep it simple no additional code of test and other required routine task is not added.

Now you know the Logic you can tweak the functionality as per your requirement.

I will comeup with more information in my up comming posts, till then keep exploring and learning.

 

Corfu Navision 2016, Development Tips, How To, Information, Instalation & Configuration, Tip & Tricks

How do I translate my ResX Files?

In my earlier post I have given the overview of Managing Multilanguage support in Navision continuing from same today I will discuss about how to translate the resx files for the Languages not available from Microsoft. 

Microsoft Translator for ResX:

To translate resx file you require to download Microsoft Translator for ResX you can use this link to download.

This will help you to translate your required .resx files

Azure Data Market account / Microsoft Translator data service:

You will need an Azure Data Market account, subscribe to Microsoft Translator data service and a register a developer application in order to use the tool.

You can start setting this up here: https://datamarket.azure.com/developer/applications/

Microsoft Translator is a service on the Windows Azure Marketplace that translates text between many languages. This is a billed service that comes with many different pricing plans. For example, one plan allows the translation of 2,000,000 characters per month for free.

PTT-2

Steps to get ready for Translation tool:

  1. Get an account on the Azure Data Market with your Microsoft Live ID.
  2. Login into the Azure Data Market (ADM).
  3. Subscribe to the Microsoft Translator Service
  4. Create an application on top of this service in order to use the service in the ResX Translator tool.
  5. Go the developer application registration
  6. Choose the Register button to create a new application.
  7. Enter your information and choose the Create button.

Make sure you note your Client ID and Client Secret, you will need this if you wish to Translate Resx files using Microsoft Translator Service.

If you remember I have shared the link from where you can download Translation Tool. You will require Customer/Partner Source.

Download the Translation Tool (NAV2016PartnerTranslationsToolkit) and extract the zip file.

Scan the extracted Folder here few important files which will help identifying purpose of these files:

  1. Microsoft.MCSUK.RESXTranslator.exe
  2. Microsoft.MCSUK.RESXTranslator.exe.xml
  3. NAV 2016 Creating Custom Platform Translations.pdf
  4. PartnerTranslations.sln

PTT-3

Each project contains the platform resource files (.resx) for all languages shipped by Microsoft.

The Visual Studio solution file, PartnerTranslations.sln, contains a project for each of the platform assemblies that contain translatable resources. In order to create a custom translation, you add the respective resource files with custom translations to the respective project.

Let us see the directory structure of “NAV2016PartnerTranslationsToolkit\Microsoft.Dynamics.Nav.Language” similar structure is for other projects too.

PTT-4

For detailed help you can refer to “NAV 2016 Creating Custom Platform Translations.pdf” file.

Let’s start with translating our resx files:

Run the “Microsoft.MCSUK.RESXTranslator.exe” Tool

PTT-5

Switch to Advanced Tab.

Enter the Client ID and Client Secret obtained in above step when we registered the Application.

Click on Save.

PTT-6

Switch to Single File Tab.

Browse the .resx file for source language in my case if have selected “Common.Language.Lang.en-US.resx

Translate To choose desired language available from the drop down. In my case I have selected “Hindi”.

Select the Language 3 char code in my case I have selected “hi-IN [HIN] Hindi (India)

Click on Translate Now.

Once resx file is translated you will get the summary of result, click ok to return.

Similarly you translate the rex files for each projects listed above.

 

PTT-7

Post this step you are ready with all of you resx file translated to desired language.

 

Corfu Navision 2016, Development Tips, How To, Tip & Tricks

Zip/Un-Zip files using 7Zip

Dear friends today I am sharing functionality created in Navision which can be used to zip or Un-Zip files. Upon request of one of follower of my blog I decided to discuss on this point.

Here below I present below how we can do the same. The variables, functions and process is self-explanatory.

Step 1: Let us create a Setup Table and Page

Zip-UnZip-1

Zip-UnZip-2

Zip-UnZip-3

Step 2: Let us define variables

Zip-UnZip-4

Name                                                    DataType             Subtype                    Length

netProcess                                         DotNet                 System.Diagnostics.Process.’System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

netProcessStartInfo                       DotNet System.Diagnostics.ProcessStartInfo.’System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

netProcessWindowStyle              DotNet System.Diagnostics.ProcessWindowStyle.’System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

ImportPath                                         Text                                                        1024

ExportPath                                         Text                                                         1024

ZipPath                                                 Text                                                        1024

ImportExportSetup                         Record                  Import Export Setup

Order                                                    Text                                                          1024 

Step 3: Let us create a Function to Get Information of Path from Setup:

Zip-UnZip-5

This function is to initialize all the required variables which will be used in other functions.

It takes value from the Setup created above to store path of required folders. 

Step 4: Let us create a Function for running Shell Command for 7zip Files:

Zip-UnZip-6

This function runs the shell script in background to Zip or Un-Zip files in specified folder.

Step 5: Let us create a Function to call UnZip file after preparing the Parameters for Command

Zip-UnZip-7

This function prepares the path, Name of File and Argument for the Shell and finally calls the Shell function to run the command in background. At the end of function you will get UnZiped files from the Zip file.

Step 6: Let us create a Function to call Zip file after preparing the Parameters for Command

Zip-UnZip-8

Zip-UnZip-9

This function prepares the path, Name of File and Argument for the Shell and finally calls the Shell function to run the command in background. At the end of function you will get Ziped file which contains the file specified in InclusiveFiles.

This way you can use above functions to Zip / Un-Zip files using 7Zip.