Tengo la necesidad de imprimir en batch archivos xml que se encuentran en determinado folder, estoy tratando de hacerlo con pdfcreator, ya que con bullzip no tuve suerte, estoy usando el c贸digo de abajo para lograr el objetivo pero me esta marcando error:
Print timeout
Error BASE/1004 No exported method: CSTART
o tambi茅n este error si utilizo la opci贸n oPDFC:cVisible := .t.
Print timeout
Error BASE/1005 No exported variable: CVISIBLE
procedure imprimirArchivoXML( cfileName )
聽local nEvent := 0
聽local nTime
聽 聽oPDFC:cVisible := .t.
聽 聽If oPDFC:cStart("/NoProcessingAtStartup") = .f.
聽 聽 聽 If oPDFC:cStart("/NoProcessingAtStartup", .t.) = .f.
聽 聽 聽 聽 聽wait "Init printer error!"
聽 聽 聽 聽 聽return nil
聽 聽 聽 聽EndIf
聽 聽EndIf
聽
聽 聽oPDFC:_cOption('UseAutosave',1)
聽 聽oPDFC:_cOption('UseAutosaveDirectory',1)
聽 聽oPDFC:_cOption("AutosaveFormat",0)
聽 聽DefaultPrinterBak := oPDFC:cDefaultprinter
聽 聽oPDFC:cDefaultprinter := "PDFCreator"
聽 聽oPDFC:cClearCache()
聽 聽oPDFC:_cOption('AutosaveFilename',"test")
聽 聽oPDFC:_cOption('AutosaveDirectory', "c:\temporal")
聽 聽oPDFC:cSaveOptions()
// print something
//oPdfC:cPrintPDFCreatorTestpage()
聽 聽oPdfC:cPrintFile( cfileName )
聽 聽oPdfC:cPrinterStop := .F.
聽 聽nTime := hb_MilliSeconds()
聽 聽do while nEvent == 0 .AND. hb_MilliSeconds() - nTime < 10000
聽 聽 聽 hb_idleSleep( 0.5 )
聽 聽 聽 /* The following dummy line is required to allow COM server to send event [Mindaugas] */
聽 聽 聽 oPdfc:_cOption( "UseAutosave" )
聽 聽enddo
聽 聽if nEvent == 0
聽 聽 聽 ? "Print timeout"
聽 聽elseif nEvent == 1
聽 聽 聽 ? "Printed successfully"
聽 聽elseif nEvent == 2
聽 聽 聽 ? "Error:", oPdfc:cError():Description
聽 聽else
聽 聽 聽 ? "Unknown event"
聽 聽endif
聽 聽//oPdfC:cDefaultPrinter := cDefaultPrinter
聽 聽oPDFC:cClose()
聽 聽oPdfC := NIL
return nilLa necesidad de hacerlo as铆 es porque tampoco he encontrado una forma de enviar directamente a impresi贸n el archivo xml, as铆 que opt茅 por convertirlo a pdf, pero no me funciona...
Agradezco cualquier ayuda con el tema.
Saludos,
Javier