PAGUE 6 MESES
LEVE 12 MESES
GARANTIR DESCONTO

Fórum Salvar em PDF/A-2b usando PDFCreator #506397

06/01/2015

0

Olá pessoal,
tenho o seguinte código que salva o arquivo em PDF normal

procedure TFrmTeste.DelphiDocsToPDF(Scriptname: string);
const
    maxTime = 5; //' in seconds
    sleepTime = 500; //' in milliseconds
var
    c: Integer;
    PDFObject: OleVariant;
begin
    if Scriptname <> EmptyStr then
        if FileExists(Scriptname) then
        begin
            PDFObject := CreateOleObject('PDFCreator.clsPDFCreator');
            PDFObject.cStart;

            PDFObject.cOption('UseAutosave') := 1;
            PDFObject.cOption('UseAutosaveDirectory') := 1;
            PDFObject.cOption('AutosaveFormat') := 0; // 0 = PDF
            PDFObject.cDefaultprinter := 'PDFCreator';
            Printer.PrinterIndex := Printer.Printers.IndexOf('PDFCreator');
            PDFObject.cClearcache;
            PDFObject.cPrinterStop := false;

            if not FileExists(Scriptname) then
            begin
                MessageDlg('Can''t find the file:' + Scriptname,mtError, [mbAbort],0);
                Exit;
            end
            else
            begin
                if not PDFObject.cIsPrintable(Scriptname) then
                    MessageDlg('An error is occured: File is not printable!' + Scriptname,mtError, [mbAbort],0);
            end;

            PDFObject.cOption('AutosaveDirectory') := ExtractFilePath(Scriptname);
            PDFObject.cOption('AutosaveFilename') := ExtractFileName(Scriptname);

            PDFObject.cPrintfile(Scriptname);

            c := 0;
            Application.ProcessMessages;
            while (c < (maxTime * 1000 / sleepTime)) do
            begin
                c := c + 1;
                Sleep(sleepTime);
            end;

            PDFObject.cClearCache;
            sleep(200);
            PDFObject.cClose;

        end
        else
            MessageDlg('Arquivo não Existe !',mtInformation, [mbOk],0);
end;


mas eu precisaria que ele salve em formato PDF/A-2b, alguém saberia como ?

agradecido
Luis Flores

Luis Flores

Responder

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar