Print Pdf File (not convert)

Hi All,

I need a solution to print pdf file which is already imported as a blob in navision. There can be mulilple pdf files which can print at a time (default printer).

I have done my investigation and came across some wonderful solution like

Root := Filename
SHELL(’“C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe”’,’ /p /h ',Root);
but the problem with this solution is that if another client has acrobat 8 installed it won’t work.

I have seen pdfcreator but i just need to print pdf document not convert or anything.

I am using window Vista
Any help would be apprecialted. Thanks

If you want to code your solution anyway, why not store the “path_to_pdf_reader(maybe_with_exe)” in the user profile (add a text variable) and use the shell command then?

SHELL(’“path_to_pdf_reader(maybe_with_exe)”’,’ /p /h ',Root);

Thanks walter.

Any other clever way of doing it??

Hi,

You should be able to find the acrobat path like this:

IF CREATE(wshShell) THEN AcrobatPath := wshShell.RegRead(‘HKCR\acrobat\shell\open\command’);

/u %1 is appended to that, removed that before use.

Bestr regards

This could be useful. Be sure to use automation objects of the type ‘Microsoft Shell Controls and Automation’.

PrintFile( FileName : Text[250])
CREATE(objShell);
IF NOT EXISTS(FileName) THEN
EXIT;
SplitDirFile(FileName,Dir,File); // nog te schrijven
objFolder := objShell.NameSpace(Dir);
objFolderItems := objFolder.Items;
objFolderItem := objFolderItems.Item(File);
objVerbs := objFolderItem.Verbs;
i:=-1;
REPEAT
i+=1;
IF i<objVerbs.Count THEN
objVerb := objVerbs.Item(i);
UNTIL (STRPOS(UPPERCASE(objVerb.Name),‘PRINT’)>0) OR (i >=objVerbs.Count);
IF i<=objVerbs.Count THEN BEGIN
objVerb.DoIt;
END ELSE
ERROR(‘Could not print file %1\Make sure you use a file extension you can print from Windows Explorer’, FileName);

It should print any filetype.

Enjoy!

What is parameter ‘File’ in SplitDirFile functions ??

While running this code its giving error that datatype is not supported by C/SIDE.