FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TITLE OF print
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
TITLE OF print
Posted: Wed Jan 21, 2026 08:47 AM

Hi,
in the file errore.pdf I find as title "Fivewin Report" and not "errore"

If I remove FILE cNomepdf when I run this little test program appears the dialog to assign the output name
and the title is correct.

PRINT oPrn TITLE cNameReport TO "Microsoft Print to PDF"

how is it possible to correct this?

Many Thanks
Marco

#include "Fivewin.ch"

FUNCTION MAIN()

LOCAL cNameReport, cNomePdf
LOCAL oPrn

cNameReport := "errore"
cNomePdf    := cNameReport + ".pdf"

PRINT oPrn TITLE cNameReport TO "Microsoft Print to PDF" FILE cNomePdf

  PAGE
    oPrn:Say( 100 , 100 , "TEST" )
  ENDPAGE

ENDPRINT

RETURN NIL
Marco Boschi
info@marcoboschi.it
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: TITLE OF print
Posted: Wed Jan 21, 2026 03:56 PM
// C:\FWH...\SAMPLES\DETLEF4.PRG

#Include "FiveWin.ch"

#Define PAD_LEFT            0
#Define PAD_RIGHT           1
#Define PAD_CENTER          2

FUNCTION Main()

   LOCAL oBrushRed, oBrushGrn
   LOCAL oPrn, nWidth, nHeight, nRow
   LOCAL oFont, oBold, cTxt
   LOCAL cBigText := MemoRead( "tutor02.prg" )

   DEFINE BRUSH oBrushRed COLOR CLR_RED
   DEFINE BRUSH oBrushGrn COLOR CLR_HGREEN

   // Before print command
   TPrinter():lUseHaruPdf := .T.
   TPreview():bButtonBar  := {| oPrv, oWnd | MyBar( oPrv, oWnd ) }

   // PRINT oPrn PREVIEW MODAL
   PRINT oPrn TITLE "PRINT TITLE: BOSCHI" PREVIEW MODAL  // NAME PREVIEW IN PRINTER, NO IN ADOBE.

  DEFINE FONT oFont NAME "CONSOLAS" SIZE 0, - 10      OF oPrn
  DEFINE FONT oBold NAME "VERDANA"  SIZE 0, - 26 BOLD OF oPrn

  oPrn:SetPage( 9 ) ; oPrn:SetPortrait()

  nWidth   := oPrn:PageWidth(  "CM" )
  nHeight  := oPrn:PageHeight( "CM" )

  PAGE

     oPrn:Say( 2, nWidth / 2, FWVERSION + " oPrn:Say()", oBold, NIL, NIL, NIL, 2, "CM" )

     oPrn:SayText( 1000, 400, "DETLEF: THE BIG TEXT IN FWH: ", 4200, 400, oBold, nil, CLR_MAGENTA, nil, "PIXEL" )

     oPrn:SayText( 1300, 400, cBigText, 4200, 4000, oFont, nil, CLR_YELLOW, oBrushRed, "PIXEL" )

     oPrn:SayText( 5700, 400, "Yellow, RedBrush DETLEF", 4200, 400, oBold, nil, CLR_YELLOW, oBrushRed, "PIXEL" )

     oPrn:SayText( 6200, 400, "Default: nil,nil DETLEF", 4200, 400, oBold, nil, nil,        oBrushGrn, "PIXEL" )

     cTxt := "kapiabafwh@gmail.com"

     oPrn:Say( 6700, 1800, cTxt, oBold, , CLR_HRED, , PAD_CENTER )

  ENDPAGE

   ENDPRINT

   TPreview():bButtonBar := nil

   RELEASE FONT oFont, oBold, oBrushRed, oBrushGrn

RETURN NIL

STATIC FUNCTION MyBar( Self, oWnd )

   LOCAL cFile   := "FIVEWIN REPORT.pdf", oFont, oBtn  // NAME IN ADOBE.
   LOCAL nAlpha  := 0x60
   LOCAL nBarClr := RGB( 0, 0x2E, 0x5C )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE BUTTONBAR ::oBar OF oWnd SIZE 48, 48 2007

   ::oBar:SetColor( { |l,o| If( l, CLR_BLACK, CLR_WHITE ) }, oWnd:nClrPane )
   ::oBar:bClrGrad := { |lInvert| If( lInvert, nArgb( 96, CLR_WHITE ), nArgb( nAlpha % 256, nBarClr ) ) }

   ::oBar:GoTop()

   DEFINE BUTTON OF ::oBar RESOURCE FWBitmap( "PDF" )   CENTER ;
      ACTION ::SaveAs( .T., cFile, .T. )

   DEFINE BUTTON OF ::oBar RESOURCE FWBitmap( "email" ) CENTER ;
      ACTION ::SendEmail()

   // By master: UWE. ( Ukoenig )
   DEFINE BUTTON oBtn OF ::oBar PROMPT "Color"  FILE "..\bitmaps\colors.bmp"  ;
      ACTION ( nBarClr := ChooseColor( RGB( 0, 0x2E, 0x5C ) ), ::oBar:Refresh() )

   DEFINE BUTTON OF ::oBar RESOURCE FWBitmap( "Exit2" ) CENTER ;
      ACTION oWnd:End()

RETURN NIL

// FIN / END - kapiabafwh@gmail.com

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: TITLE OF print
Posted: Wed Jan 21, 2026 04:25 PM

Ah ok, but how do I modify your source file so that, without preview, it creates the PDF document with the correct title? So directly create the PDF with the correct title?

Thanks again Marco

Marco Boschi
info@marcoboschi.it
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: TITLE OF print
Posted: Wed Jan 21, 2026 06:10 PM

The problem is here, inside printer.prg (look at the last line):

function MSPrintToPDF( aMeta, cFile, lView )

   local hDC, cEmf, hMeta

   if AScan( aGetPrinters(), "Microsoft Print to PDF"  ) > 0

  if Empty( cFile ) .and. Empty( cFile := cGetFile( "( *.pdf ) |*.pdf|", FWString( "File to Save" ), 1, CurDir(), .t. ) )
     return .f.
  endif
  cFile    := cFileSetExt( cFile, "pdf" )
  cFile    := TrueName( cFile )
  if File( cFile ) .and. FErase( cFile ) != 0
     ? cFile + " is in use. Can not overwrite"
     return .f.
  endif

  hDC   := PrinterDcFromName( nil, "Microsoft Print to PDF", nil )
  if StartDoc( hDC, "FiveWin Report", cFile ) > 0

Since MSPrintToPDF() function does not receive the printer object, we have to change its signature. I propose to replace this
MSPrintToPDF( oPrinter:aMeta, cPdf, lOpen )
with
MSPrintToPDF( oPrinter, cPdf, lOpen )
Antonio, do you agree? Can I make this fix as proposed?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TITLE OF print
Posted: Thu Jan 22, 2026 05:44 AM

Dear Enrico,

Antonio, do you agree? Can I make this fix as proposed?

May it break existing FWH users code ?

If not, then please proceed :)

many thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: TITLE OF print
Posted: Thu Jan 22, 2026 08:38 AM

Only if they've used the function MSPrintToPDF() directly. The function signature will change from MSPrintToPDF( aMeta, cFile, lView ) to MSPrintToPDF( oPrn, cFile, lView ) Please confirm.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TITLE OF print
Posted: Thu Jan 22, 2026 02:51 PM

Dear Enrico,

ok, then please proceed :wink:

many thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: TITLE OF print
Posted: Tue Jan 27, 2026 03:16 PM

Many thanks to all

Marco Boschi
info@marcoboschi.it

Continue the discussion