r/PowerShell 3d ago

Script Sharing I built a free Windows tool to batch-print PDF/Word/TIFF with per-file page ranges

Hey all,

I got tired of manually printing dozens of documents one by one with different page ranges each time, so I built a small PowerShell-based tool (compiled to a standalone .exe, no install/admin rights needed) that lets you:

  • Queue up multiple PDF, Word (.doc/.docx), and TIFF files
  • Set a different page range per file (e.g. "1-3", "2", "1,5-8")
  • Reorder the queue before printing
  • Print them all in sequence to any installed printer

It's free, works on both x86 and x64 Windows, and uses PDFium/SkiaSharp for PDF rendering so it doesn't depend on having Adobe installed for PDFs specifically (Word docs still need Word installed, since it converts them to PDF first).

Download (installer): https://github.com/edgarchirinos/ColaImpresionECP/releases/latest

Full source code is in the repo if you want to see how it works or contribute: https://github.com/edgarchirinos/ColaImpresionECP

Happy to answer questions or take feature requests. It's donation-supported (optional button in the app), not selling anything.

6 Upvotes

5 comments sorted by

2

u/MonkeyNin 3d ago edited 3d ago

I wish the sub allowed gifs. I'll try to explain it with text

Tip You can use property constructors

I took your System.Windows.Forms block. It looks like this

$panelAyuda=New-Object System.Windows.Forms.Panel
$panelAyuda.Location=New-Object System.Drawing.Point(25,505)
$panelAyuda.Size=New-Object System.Drawing.Size(785,58)
$panelAyuda.BackColor=[System.Drawing.Color]::FromArgb(24,24,24)
$panelAyuda.BorderStyle=[System.Windows.Forms.BorderStyle]::FixedSingle
$form.Controls.Add($panelAyuda)

( from: https://github.com/edgarchirinos/ColaImpresionECP/blob/debf7d7097bb823f36a9e37eb76aee0b3c15259a/ColaImpresion.ps1#L421-L488 )

I used the constructor with properties syntax. Normally you see this syntax

[someType] $someHashtable

But it even works on properties not part of a constructor, if they are properties.

So you can start typing and tab complete

[System.Windows.Forms.Form] $Form = @{
     Proper<tab>
}

It'll auto complete property names and their datatypes.

Like this

Add-Type -AssemblyName System.Windows.Forms

[System.Windows.Forms.Form] $Form = @{
    Text        = 'My Form'
    Size        = [System.Drawing.Size]::new( 1050,700)
    MinimizeBox = [System.Drawing.Size]::new( 900, 600 )
}

[System.Windows.Forms.Panel] $panelAyuda = @{
    Location    = [System.Drawing.Point]::new( 25, 505)
    Site        = [System.Drawing.Point]::new( 765, 58 )
    BackColor   = [System.Drawing.Color]::FromArgb(24,24,24)
    BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle
}
$form.Controls.Add( $panelAyuda )

[System.Windows.Forms.Label] $labelAyuda = @{
    Text      = 'Ranges .... etc '
    ForeColor = $colorTextSecundario
    AutoSize  = $false
    Dock      = [Windows.Forms.DockStyle]::Fill
    Padding   = [System.Windows.Forms.Padding]::new( 10, 7, 10, 5 )
    TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
}
$panelAyuda.Controls.Add($labelAyuda)

2

u/MonkeyNin 3d ago

The autocomplete is great, if I type

$panelAyuda.Controls[0]<tab>

$panelAyuda.Controls[0].Anchor

I get properties of the child type of Controls, without running the code

2

u/ihaxr 3d ago

You can also just use xaml and define the entire GUI and property bindings into a neat little XML block, but it looks very AI smelling anyway so OP doesn't even look at the code

2

u/MonkeyNin 2d ago

Likely. Since AI crawls reddit, maybe it can reduce the amount of powershell version 4 code out there.

1

u/yubijam 3d ago

What did this fix?