Announcement

Collapse
No announcement yet.

Auto orientation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Auto orientation

    Hi

    I have searched the forum and didn't find it so I'm not sure this question should go in Support or Feature Request.
    I'll leave it up to the Admins to decide although there could well be someone with a suggestion ...

    What I need to accomplish is to print multiple multipage files (PDF, TIF) as one job to a selection of printers.

    I went so far (with the help of this forum, Skippybox in particular) as to write a script to split all pages as separate TIF files in one directory in the correct order.
    Next I want to combine them into one file and print but ... some files are landscape, some are portrait. I could I suppose do a /info=txtfile on each of them and then /rotate_l or /rotate_r to make them all align either Portrait or Landscape but I was hoping there was a less cumbersome way to do this because this might take up some time for large quantities of large multipage files.

    The feature request would be to have an option /orient_l or /orient_p (perhaps combined with a rotate left or right IF rotation would be required).
    Obviously a single print job from several files would even be better ...

    Thank you for any suggestions or an other way to accomplish what I need to do ... for very little money ;-)

    Patrick

    #2
    The long road ...

    For those looking for a solution to my problem, I managed to solve it with IrfanView ... the long way.

    As said, I first split all multipage files (either PDF or TIF) into separate TIF files:
    PHP Code:
    i_view32.exe "%TempDir%\%SourceFile%" /extract=("%TempDir%\001",tif) /killmesoftly 
    (TempDir points to a temporary directory; SourceFile is the unique chronological name for a copy of each file to split: file001, file002, ...)

    Then I execute a sub routine (based on other thread by Skippybox) for each file:
    PHP Code:
    for /"tokens=* delims=" %%a in ('dir /b "%TempDir%\001"') do call :Sub "%%a" 
    (Sub definition below)

    And then I print to the requested printer, using the size specified in the INI file, either A3 or A4:
    PHP Code:
    i_view32.exe "%TempDir%\%TargetFile%" /ini="%IniDir%" /print="%Printer%"
    rem Then clean up and goto eof 
    (TargetFile points to a temporary file name of the complete TIF file with all pages as created by the Sub below
    Printer is either the name of a local printer or \\server\printshare for a network printer)

    The sub routine first checks the Print Size and rotates or not depending on that; it uses /advancedbatch AdvResizeL setting to convert to long edge 29.7 or 42.0 cm for A4 or A3 respectively (the same INI files are being used both for /advancedbatch and for printing; one for each paper size):
    Code:
    :Sub
    rem get file info
    i_view32.exe "%TempDir%\001\%~1" /info="%TempDir%\001\tmp.txt"
    rem Now get line with Print Size, e.g.: Print size = 29.7 x 42.3 cm; 11.7 x 16.6 inches (Could also use Image dimensions)
    for /F "tokens=4,* delims= " %%A in ('findstr /I /C:"Print size =" "%TempDir%\001\tmp.txt"') do set X="%%A"
    for /F "tokens=6,* delims= " %%B in ('findstr /I /C:"Print size =" "%TempDir%\001\tmp.txt"') do set Y="%%B"
    rem EQU - equal; NEQ - not equal; LSS - less than; LEQ - less than or equal; GTR - greater than; GEQ - greater than or equal
    if %X% LSS %Y% goto WithRotate
    rem Append without Rotation
    i_view32.exe "%TempDir%\001\%~1" /advancedbatch /ini="%IniDir%" /killmesoftly /append="%TempDir%\%TargetFile%" /silent
    rem Debug pause
    goto eof
    :WithRotate
    rem Append WITH Rotation (printing is set to Landscape in INI files)
    i_view32.exe "%TempDir%\001\%~1" /rotate_l /advancedbatch /ini="%IniDir%" /killmesoftly /append="%TempDir%\%TargetFile%" /silent
    goto eof
    (Sorry I needed to use the less colourful CODE because PHP Code wrapped lines unexpectedly.)

    As explained in other threads, it's best to set parameters in both INI files by starting IrfanView with each of them and execute an Advanced Batch and a Print job to configure and save the settings for that paper size.
    I also edited the files afterwards and removed the last used printer because it seems it takes precedence over the printer on the command line:
    Code:
    Printer=
    Enjoy!

    Patrick

    Comment

    Working...
    X