Advertisement
Digitalraindrops

Merge PDF

Sep 26th, 2012
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.52 KB | None | 0 0
  1.  
  2.  
  3. OnRun(VAR Rec : Record "Purchase Header")
  4. IF ISCLEAR(PDFCreator) THEN
  5.   CREATE(PDFCreator);
  6.  
  7. IF NOT PDFCreator.cStart()THEN;
  8.  
  9. IF ISCLEAR(PDFCreatorError) THEN
  10.   CREATE(PDFCreatorError);
  11.  
  12. IF ISCLEAR(PDFCreatorOption) THEN
  13.   CREATE(PDFCreatorOption);
  14.  
  15. ReportID := REPORT::"Stock Order";
  16. FileDirectory := 'C:\Temp\quickpdf\';
  17. FileName := "No." + '.pdf';
  18.  
  19. Window.OPEN('processing');
  20. WindowisOpen := TRUE;
  21.  
  22. IF FILE.EXISTS(FileDirectory + FileName)THEN
  23.   FILE.ERASE(FileDirectory + FileName);
  24.  
  25. PDFCreatorError := PDFCreator.cError;
  26.  
  27. PDFCreatorOption :=  PDFCreator.cOptions;
  28. PDFCreatorOption.UseAutosave := 1;
  29. PDFCreatorOption.UseAutosaveDirectory := 1;
  30. PDFCreatorOption.AutosaveDirectory := FileDirectory;
  31. PDFCreatorOption.AutosaveFormat := 0;
  32. PDFCreatorOption.AutosaveFilename := FileName;
  33.  
  34. PDFCreator.cOptions := PDFCreatorOption;
  35. PDFCreator.cClearCache();
  36. DefaultPrinter := PDFCreator.cDefaultPrinter;
  37. PDFCreator.cDefaultPrinter := 'PDFCreator';
  38.  
  39. //This will pause the printer to merge other pdf files
  40. PDFCreator.cPrinterStop := FALSE;
  41.  
  42. //This prints the report to PDFCreator
  43. REPORT.RUNMODAL(ReportID,FALSE,TRUE,Rec);
  44.  
  45. //The Report is Created as a PDF Here
  46. //I want to append to PDF files here!
  47.  
  48.  
  49. PDFCreator::eReady()
  50. PDFCreator.cPrinterStop := TRUE;
  51. PDFCreator.cDefaultPrinter := DefaultPrinter;
  52. PDFCreator.cClose();
  53. IF WindowisOpen THEN
  54.    Window.CLOSE;
  55. WindowisOpen := FALSE;
  56.  
  57. PDFCreator::eError()
  58. //ERROR('Status: Error[' + FORMAT(PDFCreatorError.Number) + ']: ' + PDFCreatorError.Description);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement