OBJECT Report 99977 Test Adobe PDF Printing { OBJECT-PROPERTIES { Date=12-08-08; Time=15:01:00; Modified=Yes; Version List=; } PROPERTIES { ProcessingOnly=Yes; OnPreReport=BEGIN Filename := '<a random pdf file>'; CREATE(AdobeAutomation); MESSAGE('%1',AdobeAutomation.LoadFile(Filename)); AdobeAutomation.printAll; END; } DATAITEMS { } REQUESTFORM { PROPERTIES { Width=9020; Height=3410; } CONTROLS { } } CODE { VAR AdobeAutomation@1060000 : Automation "{05BFD3F1-6319-4F30-B752-C7A22889BCC4} 1.0:{CA8A9780-280D-11CF-A24D-444553540000}:'Adobe Acrobat 7.0 Browser Control Type Library 1.0'.AcroPDF"; AdobeOCX@1060003 : OCX "{CA8A9780-280D-11CF-A24D-444553540000}:'Adobe PDF Reader'"; Filename@1060001 : Text[200]; EVENT AdobeAutomation@1060000::OnError@1(); BEGIN END; EVENT AdobeAutomation@1060000::OnMessage@2(); BEGIN END; BEGIN END. } }
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Indeed! Thanks for posting the link.
I do however have an inkling that the commands in the context menu are language specific which could make the proposed technique a little cumbersome, but the bottom line is that it works.
As an added bonus the method gives access to many of the commands in the context menu which could come in handy.
Senior NAV Developer
Elbek & Vejrup
Maybe, but does it support printing from within NAV using automations?
If not, I really couldn't care less if it's faster and lighter
Besides, the detlef-method will work with any pdf reader as long as the reader puts a (print) command in the context menu for pdf files.
This is nice <tm>
Senior NAV Developer
Elbek & Vejrup
From Shell you can print the pdf document
"Foxit Reader.exe" /p pdfdocument.pdf
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Well, I was using the shell command and printing the document using Adobe Reader (albeit it's an unsupported command line parameter), but that option has been removed in the latest version (v9). Or, to be more precise, when printing several documents it will only print the first, then wait for the user to close the Adobe application before printing the next and so on, which kinda sucks.
Initially I tried using automations to do the job as you can see in my first mail, as this is a supported interface that won't just disappear from one day to the next.
However, the detlef-method is even smarter as it doesn't even require a specific pdf reader to be used - each user can install whatever he/she wants and I don't have to ensure that the right program with the right version is accessible at the right location.
Senior NAV Developer
Elbek & Vejrup