FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to show and print a pdf file?
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
How to show and print a pdf file?
Posted: Thu Feb 29, 2024 11:57 AM

Hi Guys,

I have a PDF file that i must to show and possibly allow the user print it. how could i to do this?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: How to show and print a pdf file?
Posted: Thu Feb 29, 2024 12:17 PM
Code (fw): Select all Collapse
   ShellExecute( 0, "Print", WNOMBREARQPDF,,, 3 )
https://forums.fivetechsupport.com/viewtopic.php?f=6&t=38472

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: How to show and print a pdf file?
Posted: Thu Feb 29, 2024 12:22 PM

Thank you. I'll try it.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: How to show and print a pdf file?
Posted: Thu Feb 29, 2024 01:22 PM

Karinha,

This command prints the PDF directly and I wanted to show it before print. Is it possible ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: How to show and print a pdf file?
Posted: Thu Feb 29, 2024 03:19 PM
try
Code (fw): Select all Collapse
Shellexecute( 0, "Open", WNOMBREARQPDF )
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: How to show and print a pdf file?
Posted: Thu Feb 29, 2024 03:26 PM
Vilian, eu uso o PDFMACHINE White(Impressoara Virtual) e o SUMATRAPDF.exe para visualizar(bem levinho).

https://broadgun.com/pdfmachine/pdfmachine-white/

https://www.sumatrapdfreader.org/free-pdf-reader

Muito simples de usar.

abs.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: How to show and print a pdf file?
Posted: Thu Feb 29, 2024 03:49 PM
I show my PDF from a Xbrowse. Put link to pdf in Xbrowse or a reference.

R-Click and show a popup with option to view, print, etc..
Works very well.
Code (fw): Select all Collapse
//  Xbrowse
   :bRClicked        := {|nRow, nCol| PopRappel( nRow,nCol, oOmzet ),oOmzet:refresh() }


procedure Poprappel( nRow,nCol, oBrw )
local oMenu
   czieFact = "\\CAROLIEN-PC\DATA\EXEL\"+str(facturen->factuur,6)+".pdf"
   MENU oMenu POPUP
      MENUITEM "Mark Selection" ACTION   markrappels( oBrw )
      MENUITEM "Show PDF" ACTION  shellexecute( 0, "OPEN" , cZiefact)
      MENUITEM "Print PDF" ACTION  druk_fac()
   ENDMENU
   ACTIVATE POPUP oMenu AT nRow, nCol OF oBrw
return NIL
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: How to show and print a pdf file?
Posted: Thu Feb 29, 2024 04:05 PM
Perfect Marc.
Code (fw): Select all Collapse
#include "FiveWin.ch"

static oWnd

FUNCTION Main()

   local oBar

   DEFINE WINDOW oWnd TITLE "Imprimir PDF"

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\printer.bmp" FLAT ;
      ACTION( IMPRIMIR_PDF() ) TOOLTIP "Imprimir PDF" GROUP

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\Exit.bmp" FLAT    ;
      ACTION oWnd:End() TOOLTIP "Exit this app" GROUP

   SET MESSAGE OF oWnd TO "Imprimir PDF" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION IMPRIMIR_PDF()

   //ShellExecute(, "Print", "C:\TEMP\FWINTRO.PDF",,, 3 )  // Navarro

   ShellExecute( 0, "OPEN", "C:\TEMP\FWINTRO.PDF" )       // Acrobat

   // Con el SUMATRAPDF, no llama el adobe, es direto en la impresora.
   // Invisible. o con PDFMACHINE

RETURN NIL

// FIN
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: How to show and print a pdf file?
Posted: Thu Feb 29, 2024 04:24 PM
Thank you Guys ;)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to show and print a pdf file?
Posted: Fri Mar 01, 2024 05:12 AM
You can easily have a great PDF viewer using Class TWebView (and now using the new Class TWebView2 that does not require DLLs) :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: How to show and print a pdf file?
Posted: Fri Mar 01, 2024 10:41 AM

Mr Antonio,

Is there an example of that ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 137
Joined: Mon Oct 22, 2012 04:43 PM
Re: How to show and print a pdf file?
Posted: Fri Mar 01, 2024 01:05 PM
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local cFile, aGetFiles:={}, i

   FW_SetUnicode( .f. )

   cFile := cGetFile( "select one file  (*.pdf)|*.pdf|", ;
            "webview pdf" )
   webview( cFile )
   
   aGetFiles:=aGetFiles( "multiselect (*.pdf)|*.pdf|", "Multiple webview pdf" )
   XBrowser( aGetFiles )
   for i=1 to len(aGetFiles)
      webview(aGetFiles[i])
   next

return nil
 
 

function webview(cFile)
   local oWebView 
   
   if cFile=NIL
      return nil
   endif
   
   oWebView:= TWebView():New()

   oWebView:Navigate(cfile) 
   oWebView:SetTitle( "Microsoft Edge WebView working from FWH" )
   oWebView:SetSize( 1200, 800 )
   oWebView:Run()
   oWebView:Destroy()
return nil
Regards



Ing. Anton Lerchster
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: How to show and print a pdf file?
Posted: Fri Mar 01, 2024 01:58 PM

Thank you,

With your sample, which dll file i must save together my system ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to show and print a pdf file?
Posted: Mon Mar 04, 2024 05:22 AM

Vilian,

If you use the new Class TWebView2 in FWH 24.02 then you don't need any DLL

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion