Hola,
Observando con más detalle, veo que me he equivocado. Veamos, no hay que quitar la línea que comento sino sólo su parámetro. Si no se llama al método cStart, el PdfCreator no hace nada de nada.
Aquí un ejemplo de código que me ha funcionado:
Código Delphi
[-]
var
PrinterIndex: Integer;
OldPrinterIndex: Integer;
PdfCreator: OleVariant;
begin
PrinterIndex := Printer.Printers.IndexOf('PdfCreator');
if PrinterIndex <> -1 then
begin
OldPrinterIndex := Printer.PrinterIndex;
Printer.PrinterIndex := PrinterIndex;
PdfCreator := CreateOLEOBject('PDFCreator.clsPDFCreator');
try
PdfCreator.cStart();
PdfCreator.cOption('UseAutosave') := 1;
PdfCreator.cOption('UseAutosaveDirectory') := 1;
PdfCreator.cOption('AutosaveDirectory') := 'c:\ruta\al\archivo';
PdfCreator.cOption('AutosaveFilename') := 'test'; PdfCreator.cOption('AutosaveFormat') := 0;
Self.Print; finally
Printer.PrinterIndex := OldPrinterIndex;
while not FileExists('c:\ruta\al\archivo\test.pdf') do
Application.ProcessMessages;
PdfCreator.cClose;
end;
end;
end;
Observa que no es necesario guardar las opciones anteriores y restablecerlas después ya que no uso el método cSaveOptions.
// Saludos