{% with messages = get_flashed_messages() %}
{% if messages %}
<ulclass=flashes> {% for message in messages %}
<li>{{ message }}</li> {% endfor %}
</ul> {{updateScript}}
{% endif %}
{% endwith %}
converting pdfs
reuqires ghostscript
# ConvertPdfToTif@app.route('/utilities/pdf2tif',methods=['POST'])defConvertPdfToTif():pdfPath=request.form['pdfPath']tifPath=request.form['tifPath']flash('Converting %s to %s'%(pdfPath,tifPath))p2t=subprocess.Popen(['powershell.exe','C:\\Users\\username\\\\pdf.ps1',pdfPath,tifPath])returnrender_template('utilities_pdf2tif.html',pdfPath=pdfPath,tifPath=tifPath)
param([string]$folder,[string]$destinationfolder)$($MyInvocation.MyCommand.Definition)>>C:\Users\username\log.mdget-date|ac C:\Users\username\\log.mdwrite-host"running $($MyInvocation.MyCommand.Definition)"write-host$folder$destinationfolderSet-Location$folder$tool='\\server\GhostScript\bin\gswin32c.exe'$pdfs=get-childitem.-recurse|where {$_.Extension-match"pdf"}foreach($pdfin$pdfs){#If any pdf is found in the source folder, checks to see if the destination folder exists, and if doesn't, creates it.if(-Not(test-path$destinationfolder)){New-Item-ItemTypeDirectory-Force-Path$destinationfolder}#Sets the $tiff variable based on the name of the pdf, removes spaces.$tiff=$destinationfolder+'\'+($pdf.BaseName.split('.')[0]-replace(" ",""))+'.tif'Write-HostTiffpathis$tiff#Checks to see if the tiff file already exists as destination folder and skips it.if(test-path$tiff){"TIFF file already exists: "+$tiff}else{'Processing '+$pdf.Name#Sets the output parameter for ghostscript. Can expand functionality later if necessary.$param="-sOutputFile=$tiff"&$tool-q-dNOPAUSE-sDEVICE=tiffg4$param-r300$pdf.FullName-cquit}}