pagewidth

  • 05 May

    Check pdf pagewidth in order to move files to a different folder

    Q: A big help would also be a width check. If pdf width > 300 mm move to another folder. Then I could use some system tools on the pdf.

    A: In version v2022.5.5.0 we added some Pascal Script function to achieve this.

    -First we added two WIN destinations.

    • Destination with ID1 should contain the pdf files with a width <= 300 points
    • Destination with ID2 should contain the pdf files with a width > 300 points

    Limagito File Mover multiple Windows destinations

    -Next you’ll some Pascal Script

    Limagito FileMover Pascal Script option

    -Please Add and Enable ‘On Destinations

    Var
      tmpCount: Integer;
      tmpHeight, tmpWidth: Double;
      tmpFile: String;
    Const
      ctMaxWidth = 300;  
    Begin
      psExitCode:= -1;
      // ... add your code here
      tmpFile := psFilePath + psFileName;
      If psPdfGetPageCount(tmpFile, '', tmpCount) Then
        psLogWrite(1, '', 'Page Count of ' + tmpFile +' : ' + IntToStr(tmpCount));
      If psPdfGetPageHeight(psFilePath+psFileName, '', 1, tmpHeight) Then
        psLogWrite(1, '', 'Page Height of ' + tmpFile + ' : ' + FloatToStr(tmpHeight));
      If psPdfGetPageWidth(psFilePath+psFileName, '', 1, tmpWidth) Then
      Begin
        psLogWrite(1, '', 'Page Width of ' + tmpFile + ' : ' + FloatToStr(tmpWidth));
        // Check Width
        // Pdf Files <= ctMaxWidth should go to DestinationID 1 
        // Pdf Files > ctMaxWidth should go to DestinationID 2    
        If (psDestinationID = 'ID1') And (tmpWidth <= ctMaxWidth) Then psExitCode := 1; 
        If (psDestinationID = 'ID2') And (tmpWidth > ctMaxWidth) Then psExitCode := 1;  
      End
      Else
      begin
        // Error Loading Pdf File, set psExitCode to 0
        psExitCode := 0;
      End;   
    End.

    Limagito File Mover Pascal Script

    – RunTime Log Result:

    Limagito File Mover RunTime Log result

    #Filetransfer #PDF

    If you need any info about this ‘Check pdf pagewidth’ option, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Pascal Script PDF ,
SEARCH