PDF Writer

This forum is for eXpress++ general support.
Post Reply
Message
Author
omni
Posts: 531
Joined: Thu Jan 28, 2010 9:34 am

PDF Writer

#1 Post by omni »

Roger,

Most of my users use Bullzip now, which is great. I have one user that has 20-30 work stations, all installed with PDFcreater. He wants to use it only on some custom programs to send emails with our system using his pdf writer. I did not think it would be a problem using prntname for the printer and it does create a pdf file, but it is not readable. I used the same code as bullzip for the dcprint command.

DCPRINT on NAME prntname size 60,84 margin 3 TO oPrinter TOFILE OUTFILE &newfile OVERWRITE FONT '9.Arial'

where prntname is PDFcreater.

Has anybody had any experience with this pdf writer? If not, then I will tell him to install bullzip.


Fred
Omni

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: PDF Writer

#2 Post by rdonnay »

Fred -

I have worked with other PDF systems with Xbase++ and the only successes I have had, up to now, are Win2PDF and Bullzip.

I think I recall trying to get PDFcreator to work at one time but could never get it to produce a proper PDF file.

I'm afraid that I could spend a lot of time on this again and I don't have that free time available now.

Roger
The eXpress train is coming - and it has more cars.

Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

Re: PDF Writer

#3 Post by Koverhage »

Fred,

in PDFCreator you can set the Path and File Name for the output and more,
This settings are stored in ther registry.
You doesn't need the output command from dcprint.

If the file must be stored for later use, you can changes the filename
in the registry before printing or copy the file after send/print it.
Klaus

Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

Re: PDF Writer

#4 Post by Zdeno Bielik »

Hi Roger, Fred,

I use PDFCreator in some my apps with no problems for creating and printing PDF output.

This is trick:
- in PDFCrerator's Options just set Automatically saving printed documents in wanted location and needed name, e.g. d:\myprint.pdf
- in create function add this DCPRINT ON TO M->poPrinter NAME 'PDFCreator' && ORIENTATION 2
- in print function just wait/test for finishing creating pdf - pdfcreator needs a few seconds (if it is not possible rename created file it is still in progress)
If ( FRename( 'd:\myprint.pdf', ( cDisk + 'temptlac.pdf' ) ) == 0 )
FRename( ( cDisk + 'temptlac.pdf' ), 'd:\myprint.pdf' )
Exit
EndIf

- show/print created file

note: attached code(see bellow) is extracted from real app, so please, ignore some comments and variables

HTH
Zdeno

s pozdravom

zdeno bielik
ace system, spol. s r.o.
štiavnická 18
949 01 nitra
http://www.acesystem.sk
tel: 0904 – 328 888

... s nami dostávate vždy viac



Code: Select all

M->pnDriver := 1

MakeReport()
PrintReport()

*

*******************
Function MakeReport()
*******************

Local bEvalPreview := { |o,p| o:SetFrameState( XBPDLG_FRAMESTAT_MAXIMIZED ), p:zoom(p:zoomFactor + (p:zoomIncr*3) ) }
Private poPrinter, pnLine := 0, pnMove := 0.7, pnPage := 1, pcFont := '10.Courier New CE'

...

Do Case
Case ( M->pnDriver == 1 )
     DCPRINT ON TO M->poPrinter NAME 'PDFCreator'     && ORIENTATION 2
Case ( M->pnDriver == 2 )
     DC_PrintPreviewAcrobatOpt( { 0, nil, '5', nil, nil, .f., 'Win2PDF', 3 } )
     DCPRINT ON NAME 'Win2PDF' TOFILE OUTFILE ( M->aFirma[ 1, 22 ] ) TO M->poPrinter TITLE ( M->aFirma[ 1, 22 ] )
Case ( M->pnDriver == 3 )
     DCPRINT ON PREVIEW TO M->poPrinter HIDE NONSTOP EXITAFTERPRINT        && BUSYMESSAGE 'generujem stránky...'
Otherwise
     MyAlert( 'No supported PDF driver installed!' )
     Release poPrinter, pnLine, pnMove, pnPage, pcFont
     DC_GetDestroy(GetList)
     My_dbSelectArea( cOldAlias )
     lRet := { .F., '' }
     Return ( lRet )
EndCase

If ( ( ValType( M->poPrinter ) != 'O' ) .or. ( M->poPrinter:lActive == .F. ) )
   MyAlert( 'Eror while creating printer object...' )
   Release poPrinter, pnLine, pnMove, pnPage, pcFont
   DC_GetDestroy(GetList)
   My_dbSelectArea( cOldAlias )
   lRet := { .F., '' }
   Return ( lRet )
EndIf

...

DCPRINT ...
DCPRINT ...
DCPRINT ...
DCPRINT ...

...

If ( M->pnDriver == 3 )   && internal DC-Preview system
   Eval( bEvalPreview, M->poPrinter:oDlg, M->poPrinter:oPreview )
EndIf


DCPRINT OFF


Release poPrinter, pnLine, pnMove, pnPage, pcFont
DC_GetDestroy(GetList)
My_dbSelectArea( cOldAlias )
lRet := { .T., cRet }

Return ( lRet )

*

********************
Function PrintReport( p1, p2, p3 )
********************

&& p1 == nDoklad
&& p2 == P/V/D/F-F/F-R/F-X/SZ/I/U
&& p3 -/+/K

Local GetList := {}, GetOptions
*
Local nRecNo     := 0         && ( M->cAlias1 )->( RecNo() )
Local cOldAlias  := ''        && Alias()
Local oFocus     := SetAppFocus()
* Local nTemp  := 0
Local cTypDoklad := ''
Local cTemp
Local lTemp
Local cDisk      := SubStr( AllTrim( M->aFirma[ 1, 22 ] ), 1, 3 )
Local cAdrPdf
Local cNazSub    := ''
Local cNazOdb    := ''
Local xTemp
Local bErrorBlock, oError, lError := .F.
*
Local oBusyDlg, oStatic, lStatus := .T., oDlg, nCount := 0, nCountMax := 10 /*120*/, nReset := 0, nMaxReset := 3, ;
      cMessage := 'Chvíľu strpenia, prosím, čakám na vytlačenie zostavy ...'

     cTypDoklad := 'faktura03'
     cAdrPdf := ( M->aS[ S_cLok_Adr ] + 'PDF\Faktury03\' )


cTemp := PadL( AllTrim( Str( p1, 8 ) ), 8, '0' )

FErase( 'd:\myprint.pdf' )

FErase( ( cDisk + 'Xbase++ Spooled Print Job.pdf' ) )

bErrorBlock := ErrorBlock( {|e| Break(e)} )
BEGIN SEQUENCE

           xTemp := t_faktura( p1, 'R' )
           lTemp   := xTemp[1]
           cNazOdb := xTemp[2]


      If lTemp

         If ( M->pnDriver != 3 )

*                Do While ( .T. .and. ( nCount < nCountMax ) )
                  If ( FRename( 'd:\myprint.pdf', ( cDisk + 'temptlac.pdf' ) ) == 0 )
                     FRename( ( cDisk + 'temptlac.pdf' ), 'd:\myprint.pdf' )
                     Exit
                  EndIf
*                   If ( nCount >= nCountMax )
*                      If ( nReset <= nMaxReset )
*                         nReset ++
*                         nCount := 0
* *                        MyAlert( 'reseting...' )
*                      EndIf
*                   EndIf
*                   DC_Pause( 0.25 )
*                EndDo

               DC_BusyOff( oBusyDlg )

               If ( nCount < nCountMax )
*                  Copy File ( M->aFirma[ 1, 22 ] ) To ( M->aS[ S_cLok_Adr ] + cTypDoklad + '.pdf' )
*                  Copy File ( M->aFirma[ 1, 22 ] ) To ( cAdrPdf + cTypDoklad + '_'+ cTemp + '.pdf' )
                  RunShell( ( M->aS[ S_cLok_Adr ] + cTypDoklad + '.pdf' ), M->pcAdobe )
*                   DC_SpawnURL( ( M->aS[ S_cLok_Adr ] + cTypDoklad + '.pdf' ) )
               Else
                  MyAlert( 'Ľutujem, z nejakého dôvodu sa nepodarilo vytvoriť tlačovú zostavu !' )
               EndIf

         EndIf

      EndIf

RECOVER USING oError

      DC_BusyOff( oBusyDlg )
      oBusyDlg := NIL
      oDlg     := NIL
      lError   := .T.
      MyAlertTM( 'Print was NOT successfull ' + p2 + ', číslo: ' + AllTrim( Str( p1 ) ) + '...' )

END SEQUENCE
ErrorBlock( bErrorBlock )


SetAppFocus( oFocus )

My_dbSelectArea( cOldAlias )

DC_GetDestroy(GetList)
* DC_ClearEvents()

If lError
   MyAlertTM( 'TD - Končím, vyskytla sa chyba...' )
   User( .F. )
   UserLog( .F. )
*    ActiveLog( .F., .T. )     && toto bolo vypnute, lebo sa to vola vo f. Koniec()...
   ZapisPDI( 'td end', .T. )
   Koniec()
EndIf

Return ( { nRecNo } )

*


Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

Re: PDF Writer

#5 Post by Zdeno Bielik »

one more note: PDFCreator is only one free virtual PDF driver, which prints corrects our national regional characters (I tried/tested many-many-many other pdf printer drivers)
Win2PDF or Bullzip or any others, which I tested, doesn't correct print at all or only some our national characters(non english chars) was printed "ok"

John Hohensee
Posts: 26
Joined: Fri Mar 04, 2011 7:35 am
Location: San Bernardino, CA USA
Contact:

Re: PDF Writer

#6 Post by John Hohensee »

I have been using FoxIt Pdf writer it also free and prints to a PDF any where you want it with any name also.

Post Reply