Solved

Printing PDF Document Programmatically

Posted on 2009-05-05
3
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

724 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