Solved

Printing PDF Document Programmatically

Posted on 2009-05-05
3
240 Views
Last Modified: 2012-05-06
Dear Experts,

I have a stream which contants the XML document and is transformed using XSL and now i want to send it(stream) directly for printing to my default printer.
I am using Microsoft dynamics NAV, which is very similar to VB 6 but not that much flexible.

Regards
Brij
0
Comment
Question by:brijbmishra
  • 2
3 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 24346958
brijbmishra,

See the info in this link:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Access_Coding-Macros/Q_24312909.html?cid=238#a24117642

Add the published code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Public Sub PrintFile(byval sFile as String)
    Call ShellExecute(Application.hWndAccessApp, "print", sFile, "", "", 0)
End Sub

...To a Module then call the *SUB* (PrintFile) passing in full pathname.
Like so:
   
    Call PrintFile("C:\YourFolder\YourFile.abc")

This will print the file.

;-)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 25273335
Also please remember that printing the document and printing the pdf will result in the exact same output.

So in may cases, unless you need to save the data as PDF, you print the report but save it as PDF as well.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now