5. März 2021 10:23
// alles auf Anfang ...
CLEAR(PDFCreatorQueue);
CLEAR(PDFCreator);
SLEEP(1000);
IF ISCLEAR(PDFCreatorQueue) THEN
CREATE(PDFCreatorQueue);
// *** Erläuterung siehe unten ***
PDFCreatorQueue.Initialize();
SLEEP(1000);
IF ISCLEAR(PDFCreator) THEN
CREATE(PDFCreator);
IF CONFIRM('AddFileToQueue',TRUE) THEN;
PDFCreator.AddFileToQueue('C:\Temp\TestfileOnServer.pdf');
// warten auf Job und abarbeiten ...
Seconds := 0;
REPEAT
SLEEP(1000);
Seconds += 1;
UNTIL (PDFCreatorQueue.WaitForJob(10)) OR (Seconds > 20);
IF Seconds <= 20 THEN BEGIN
PrintJob := PDFCreatorQueue.NextJob;
PrintJob.SetProfileByGuid('DefaultGuid');
PrintJob.SetProfileSetting('OpenViewer','false');
PrintJob.ConvertTo('C:\Temp\TestFileOnClient.pdf');
END;
// aufräumen ...
PDFCreatorQueue.ReleaseCom();
11. März 2021 13:17
Name DataType Subtype Length
FileManagement Codeunit File Management
pdfium_Document DotNet PdfiumViewer.PdfDocument.'PdfiumViewer, Version=2.13.0.0, Culture=neutral, PublicKeyToken=91e4789cfb0609e0'
printerSettings DotNet System.Drawing.Printing.PrinterSettings.'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
printDocument DotNet System.Drawing.Printing.PrintDocument.'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
PrintPdfDocument(FullPath : Text;Printername : Text) : Boolean
printerSettings := printerSettings.PrinterSettings();
IF Printername <> '' THEN
printerSettings.PrinterName := Printername;
IF NOT printerSettings.IsValid THEN
ERROR('Druckeinstellungen sind ungültig.');
pdfium_Document := pdfium_Document.Load(FullPath);
printDocument := pdfium_Document.CreatePrintDocument();
WITH printDocument DO BEGIN
PrinterSettings := printerSettings;
DocumentName(FileManagement.GetFileName(FullPath));
Print();
END;
EXIT(TRUE);