How to show and print a pdf file?

How to show and print a pdf file?

Postby vilian » 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
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: How to show and print a pdf file?

Postby karinha » Thu Feb 29, 2024 12:17 pm

Code: Select all  Expand view

   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
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: How to show and print a pdf file?

Postby vilian » 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
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: How to show and print a pdf file?

Postby vilian » Thu Feb 29, 2024 1: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
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: How to show and print a pdf file?

Postby leandro » Thu Feb 29, 2024 3:19 pm

try
Code: Select all  Expand view

Shellexecute( 0, "Open", WNOMBREARQPDF )
 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: How to show and print a pdf file?

Postby karinha » Thu Feb 29, 2024 3: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
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: How to show and print a pdf file?

Postby Marc Venken » Thu Feb 29, 2024 3: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: Select all  Expand view


//  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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: How to show and print a pdf file?

Postby karinha » Thu Feb 29, 2024 4:05 pm

Perfect Marc.

Code: Select all  Expand view

#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
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: How to show and print a pdf file?

Postby vilian » Thu Feb 29, 2024 4:24 pm

Thank you Guys ;)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: How to show and print a pdf file?

Postby Antonio Linares » Fri Mar 01, 2024 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to show and print a pdf file?

Postby vilian » 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
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: How to show and print a pdf file?

Postby alerchster » Fri Mar 01, 2024 1:05 pm

Code: Select all  Expand view
#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
User avatar
alerchster
 
Posts: 64
Joined: Mon Oct 22, 2012 4:43 pm

Re: How to show and print a pdf file?

Postby vilian » Fri Mar 01, 2024 1: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
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: How to show and print a pdf file?

Postby Antonio Linares » Mon Mar 04, 2024 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 63 guests