FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Modificar objeto de windows Impresora PDF
Posts: 149
Joined: Thu Jun 21, 2007 03:26 PM
Modificar objeto de windows Impresora PDF
Posted: Wed Aug 31, 2011 02:54 PM

Hola. Tengo un script en VBScript que hace esto:

Set oBullZipPDF = CreateObject("Bullzip.PDFPrinterSettings")

oBullZipPDF.SetValue "Output", sArchivo
oBullZipPDF.SetValue "ConfirmOverwrite", "no"
oBullZipPDF.SetValue "ShowSaveAS", "never"
oBullZipPDF.SetValue "ShowSettings", "never"
oBullZipPDF.SetValue "ShowPDF", "never"
oBullZipPDF.SetValue "RememberLastFileName", "no"
oBullZipPDF.SetValue "RememberLastFolderName", "no"
oBullZipPDF.WriteSettings False

o sea, crea un objeto de tipo impresora bullzip (que es una impresora PDF shareware muy copada), y le cambia parametros. Esto en VBSCRIPT funciona perfectamente.

Mi duda, ¿se puede hacer lo mismo con FWH?
¿como tengo que hacer? me interesa ahora esto del pdf, pero si alguien tiene la info y un cachito de tiempo, tambien quisiera saber si puedo manejar de alguna forma cualquier objeto de windows. Probé con el formato que se usa para los oExcel, pero no funcionó.

Espero puedan ayudarme. Gracias.

Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Modificar objeto de windows Impresora PDF
Posted: Wed Aug 31, 2011 05:06 PM
Hola

teoricamete deberia funcionar, este es un ejemplo usado publicado en la misma paguina de bullpdf, a mi me genera un error de timeout, pero pasa por todos los setting sin problemas, puede que veas algo que no he visto yo para hacerte el ejemplo

el rtf que use es el mismo que esta en la cartepa samples de fivewin

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

function main()

   local util     := CreateObject("Bullzip.PdfUtil")
   local settings := CreateObject("Bullzip.PDFPrinterSettings")
   local output   := "example.pdf"
   local statusfile := "status.ini"
   local documentfile := "testrtf.rtf"

   printername := util:DefaultPrinterName()
   

   settings:SetPrinterName( printername )
   settings:SetValue( "Output", output )
   settings:SetValue( "WatermarkText", DToC( Date() ) )
   settings:SetValue( "WatermarkColor", "#FF9900" )
   settings:SetValue( "ShowSettings", "never" )
   settings:SetValue( "ShowPDF", "no" )
   settings:SetValue( "ShowProgress", "no" )
   settings:SetValue( "ShowProgressFinished", "no" )
   settings:SetValue( "ConfirmOverwrite", "no" )
   settings:SetValue( "StatusFile", statusfile )
   settings:SetValue( "StatusFileEncoding", "unicode" )

   //Write settings to the runonce.ini.
   settings:WriteSettings( .T. )

   // Remove old output and status files
   if File( output ) 
      FErase( output )
   endif
   if File( statusfile ) 
      FErase( statusfile )
   endif

   //Print the file
   util:PrintFile( documentfile, printername )
  
   // Wait for the status file.
   // The printing has finished when the status file is written.
   if util:WaitForFile(statusfile, 10000) 
        ? "Print job finished."
   else
        ? "Print job timed out."
   end if
  
return nil

Continue the discussion