Physically printing scanned PDF files to a printer

Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
Olla,

A few years ago I created a solution to print scanned PDF files to a printer. These are freight documents that should be send along with the invoice.

Back then I used VeryPDF, that allows printing from one script without the PDF reader opening and closing al the time since you might print dozens of documents in batch.

Now I have the same request a few years later and naive me thinks there should be a more nicer way, for example with com or notnet interop.

I tried using the PDFCreator com libraries but it seems that this eventually also just opens the PDF reader, so it does not work as seamless as it should.

Anyone has working solutions that are technically nicer than the script?

Thanks.

Comments

  • mdPartnerNLmdPartnerNL Member Posts: 802
    Not exactly sure what you are looking for but we use eDocPrinter with embedded commands. One large print job can create multiple emails/pdf files.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    No, I mean exactly the other way around.

    I have the pdf files, but I want to print them to a normal printer.
  • mdPartnerNLmdPartnerNL Member Posts: 802
    viewtopic.php?t=7293

    I also found this Form. Can't remember from where?
    OBJECT Form 50101 Print Any File
    {
      OBJECT-PROPERTIES
      {
        Date=17.09.08;
        Time=13:08:22;
        Modified=Yes;
        Version List=NLO;
      }
      PROPERTIES
      {
        Width=7920;
        Height=1870;
      }
      CONTROLS
      {
        { 1101101001;TextBox;3630 ;220  ;4070 ;440  ;CaptionML=[ENU=Select a file;
                                                                NOR=Velg fil];
                                                     SourceExpr=PrintThisFile;
                                                     OnAssistEdit=BEGIN
                                                                    PrintThisFile := CommonDialogMgt.OpenFile(Text001,'',1,'',0);
                                                                  END;
                                                                   }
        { 1101101002;Label  ;220  ;220  ;3300 ;440  ;ParentControl=1101101001 }
        { 1101101003;CommandButton;1540;990;2200;550;CaptionML=[ENU=Print File;
                                                                NOR=Skriv ut fil];
                                                     OnPush=BEGIN
                                                              IF ISCLEAR(objShell) THEN
                                                                CREATE(objShell);
    
                                                              IF NOT EXISTS(PrintThisFile) THEN
                                                                ERROR(Text003,PrintThisFile);
    
                                                              SplitDirFile(PrintThisFile,Dir,FileName);
    
                                                              objFolder := objShell.NameSpace(Dir);
                                                              objFolderItems := objFolder.Items;
                                                              objFolderItem := objFolderItems.Item(FileName);
                                                              objFolderItem.InvokeVerb('PRINT');
                                                              objVerbs := objFolderItem.Verbs;
    
                                                              CurrForm.CLOSE;
                                                            END;
                                                             }
        { 1101101005;CommandButton;3960;990;2200;550;PushAction=Close }
      }
      CODE
      {
        VAR
          CommonDialogMgt@1101101002 : Codeunit 412;
          PrintThisFile@1101101013 : Text[250];
          Dir@1101101010 : Text[250];
          FileName@1101101012 : Text[250];
          objShell@1101101001 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{13709620-C279-11CE-A49E-444553540000}:'Microsoft Shell Controls And Automation'.Shell";
          Text001@1101101003 : TextConst 'ENU=Select a file...;NOR=Velg fil...';
          Text002@1101101004 : TextConst 'ENU=Could not print file %1.\Make sure you use a file extension you can print from Windows Explorer.;NOR=Kunne ikke skrive ut fil %1.\Det er kun mulig † skrive ut filtyper som kan skrives ut fra Windows Explorer.';
          objFolder@1101101005 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{BBCBDE60-C3FF-11CE-8350-444553540000}:'Microsoft Shell Controls And Automation'.Folder";
          objFolderItems@1101101006 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{744129E0-CBE5-11CE-8350-444553540000}:'Microsoft Shell Controls And Automation'.FolderItems";
          objFolderItem@1101101007 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{FAC32C80-CBE4-11CE-8350-444553540000}:'Microsoft Shell Controls And Automation'.FolderItem";
          objVerbs@1101101009 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{1F8352C0-50B0-11CF-960C-0080C7F4EE85}:'Microsoft Shell Controls And Automation'.FolderItemVerbs";
          i@1101101008 : Integer;
          Text003@1101101000 : TextConst 'ENU=Couldn''t find the file %1.\Please check that the path and filename is correct.;NOR=Fant ikke filen %1.\Vennligst sjekk at filstien og filnavnet er riktig.';
          Text004@1101101014 : TextConst 'ENU=PROPERTIES;NOR=EGENSKAPER';
          Text005@1101101015 : TextConst 'ENU=OPEN;NOR=PNE';
    
        PROCEDURE SplitDirFile@1101101000(FullString@1101101000 : Text[250];VAR JustDir@1101101001 : Text[250];VAR JustFileName@1101101002 : Text[250]);
        VAR
          ExitLoop@1101101003 : Boolean;
          PointBreak@1101101004 : Integer;
        BEGIN
          ExitLoop := FALSE;
          PointBreak := STRLEN(FullString);
          WHILE (NOT ExitLoop) OR (PointBreak <= 1) DO
            IF COPYSTR(FullString,PointBreak,1) = '\' THEN BEGIN
              JustFileName := COPYSTR(FullString,PointBreak + 1);
              ExitLoop := TRUE;
            END ELSE
              PointBreak -= 1;
    
          JustDir := COPYSTR(FullString,1,PointBreak);
        END;
    
        BEGIN
        END.
      }
    }
    
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Thanks. But I know that you can use scripting, I was hoping for a more sophisticated way like Com/DotNet.
Sign In or Register to comment.