Jump to content

Editing PiWeb reports...


---
 Share

Recommended Posts

I need to add an Export Controlled Information clause to BACK of the last page in my PiWeb printouts, so it's still identifiable as sensitive information if the packet is face down.  This last page back needs to be blank except for this statement.

How can I set up PiWeb to print this on the back of the last page?

Link to comment
Share on other sites

I would just think to just add a new page and then add the statement. 

You could also just add this as the header/footer to the Master Page, so that it prints on every page. 

Link to comment
Share on other sites

Well.... wouldn't that only work on even odd number page of reports? Because if you have measurement data on (2) pages, then if it was on the back it would be watermarked over the last?

Link to comment
Share on other sites

I'm sorry Richard, I'm not understanding you.  My current part has a report that's 4 pages total.  The last page in the packet, needs to have a statement printed on the back of it, not on the front side with the data.  So when I'm done, the report has a cover sheet with the statement (which I've done) and the back of the last page has the statement.

 

No matter which side of the packet you see, all you see are the export restriction clauses.

Link to comment
Share on other sites

Please sign in to view this username.

 Can you send me your PiWeb Report, and let me take a look at it? You can direct message me if you'd like. 

Link to comment
Share on other sites

Since you already have a cover sheet for the front, couldn't you just print that twice and have the operator staple it to the back facing backwards?

If the doesn't work for you, then there are virtual print manager software that can do this I think.  For example, you can tell it to concatenate a document to the front and back of every thing printed.  Something like [cover page] + [CMM Report] + [cover page].    Stuff like FinePrint or Print2PDF.

I think you're going to have better luck doing this outside of PiWeb.  

 

Link to comment
Share on other sites

Chad, 

I don't hate this idea, but I don't think it will satisfy the requirement. 

There's a bit of this that doesn't make sense to me.  As far as I know, the customer doesn't get printed copies of our reports.  They only get PDF's or Excel files, or text files, so what's the point of having a coversheet, on the rear page of a packet, that doesn't get printed?

Not to speak poorly of a customer requirement, but if I understood more, I'd be better prepared to satisfy the requirement.

Edited
Link to comment
Share on other sites

If you can't figure it out in PiWeb, then I think you'll be stuck with a print manager software or PDF editor.  You could then use AI to write you a script that automatically stitches the cover letters to the PDF.  

GhostScript would be a good option.  Here's a sample GhostScript powershell that AI wrote

For example.

CMM Exports PDF to a folder > When new files land in that folder Script stitches cover letter to front and back > Script saves PDF with cover letters to new file location.  

 

# ====================================================================
# Configuration: Update these paths to match your environment
# ====================================================================
$watchFolder  = "C:\Paths\To\WatchFolder"
$outputFolder = "C:\Paths\To\OutputFolder"
$frontCover   = "C:\Paths\To\front_cover.pdf"
$backCover    = "C:\Paths\To\back_cover.pdf"

# Path to the Ghostscript executable (Check your installed version number)
$gsPath       = "C:\Program Files\gs\gs10.03.0\bin\gswin64c.exe" 
# ====================================================================

# Set up the folder watcher
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = $watchFolder
$watcher.Filter = "*.pdf"
$watcher.IncludeSubdirectories = $false
$watcher.EnableRaisingEvents = $true

Write-Host "Watching $watchFolder for new PDFs..." -ForegroundColor Green

# Define what happens when a new file is detected
$action = {
    $path = $Event.SourceEventArgs.FullPath
    $name = $Event.SourceEventArgs.Name
    $outputPath = Join-Path $outputFolder $name

    Write-Host "New PDF detected: $name"

    # Wait for the file lock to release (ensures the file is fully copied before processing)
    $fileLocked = $true
    $retryCount = 0
    while ($fileLocked -and $retryCount -lt 15) {
        try {
            $stream = [System.IO.File]::Open($path, 'Open', 'Read', 'None')
            $stream.Close()
            $fileLocked = $false
        } catch {
            Start-Sleep -Seconds 1
            $retryCount++
        }
    }

    if (-not $fileLocked) {
        Write-Host "Stitching covers to $name..."
        # Execute Ghostscript
        & $gsPath -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="$outputPath" "$frontCover" "$path" "$backCover"
        
        Write-Host "Successfully saved to: $outputPath" -ForegroundColor Cyan
        
        # Optional: Delete the original file after processing to keep the watch folder clean
        # Remove-Item -Path $path -Force
    } else {
        Write-Host "Error: Timeout waiting for $name to unlock." -ForegroundColor Red
    }
}

# Register the event to trigger the action
$job = Register-ObjectEvent $watcher "Created" -Action $action

# Keep the script running continuously
try {
    while ($true) { Start-Sleep -Seconds 1 }
} finally {
    # Clean up the background job if you stop the script (Ctrl+C)
    Unregister-Event -SourceIdentifier $job.Name
    $watcher.Dispose()
}

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...