Solved

Printing PDF Document Programmatically

Posted on 2009-05-05
3
243 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
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…

813 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

11 Experts available now in Live!

Get 1:1 Help Now