Calling Adobe Automations and/or OCX

rocatis
Member Posts: 163
I'm trying to do what surely must be on the top 10 list of Simple Things That Should Be Easy To Implement. I want to print a PDF document from within NAV.
I used to run AcroRd32.exe with the /t parameter but in their infinite wisdom Adobe has decided to mess up this (albeit unsupported) feature, meaning that I cannot print multiple documents anymore.
My code looks like this:
This will display "No" (meaning that the file was not loaded) and do nothing else. I get the same result using the OCX (the example above uses the automation).
Can anyone point me in the right direction here?
I used to run AcroRd32.exe with the /t parameter but in their infinite wisdom Adobe has decided to mess up this (albeit unsupported) feature, meaning that I cannot print multiple documents anymore.
My code looks like this:
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. } }
This will display "No" (meaning that the file was not loaded) and do nothing else. I get the same result using the OCX (the example above uses the automation).
Can anyone point me in the right direction here?
Brian Rocatis
Senior NAV Developer
Elbek & Vejrup
Senior NAV Developer
Elbek & Vejrup
0
Comments
-
Maybe you can use the code posted by "detlef" in this thread: Print files with an associated applicationNo support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
There are other pdf readers like Foxit pdf. It is much faster and lighter than pdf reader.0
-
Luc Van Dyck wrote:Maybe you can use the code posted by "detlef"
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.Brian Rocatis
Senior NAV Developer
Elbek & Vejrup0 -
ara3n wrote:There are other pdf readers like Foxit pdf. It is much faster and lighter than pdf reader.
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>Brian Rocatis
Senior NAV Developer
Elbek & Vejrup0 -
Why use automation when you can use shell cmd
From Shell you can print the pdf document
"Foxit Reader.exe" /p pdfdocument.pdf0 -
ara3n wrote:Why use automation when you can use shell cmd
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.Brian Rocatis
Senior NAV Developer
Elbek & Vejrup0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions