FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour From Fivewin program I have to print a Pdf
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
From Fivewin program I have to print a Pdf
Posted: Wed Sep 04, 2013 09:06 AM
Hi,
I have to print a two pages Pdf file directly from a Fivewin application.
In Duplex mode
This little program does not work
It print but not in duplex mode
Any Hints?

Code (fw): Select all Collapse
#include "fivewin.ch"

FUNCTION MAIN()

SETPRINTDEFAULT( "MYPRINTER")

PRNDUPLEX()

shellexecute( "0 , "print" , "c:\myfiles\myfile.pdf" ) 

RETURN NIL
Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: From Fivewin program I have to print a Pdf
Posted: Wed Sep 04, 2013 10:17 AM
Marco,

The printer object that FWH and ShellExecute() use are different ones, though the phisical printer is the same.

if you are going to use ShellExecute() then you have to use WMI to change the duplex mode. This may help:

Code (fw): Select all Collapse
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_PrinterConfiguration")
For Each objPrinter in colInstalledPrinters
    objprinter.Duplex = "True"
next
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: From Fivewin program I have to print a Pdf
Posted: Wed Sep 04, 2013 10:19 AM

It seems as all the properties of Win32_PrinterConfiguration are read-only, so WMI will not help

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: From Fivewin program I have to print a Pdf
Posted: Wed Sep 04, 2013 02:36 PM

Ok thanks
marco

Marco Boschi
info@marcoboschi.it

Continue the discussion