The same procedure as every couple of years : After IT migrated to new servers, all PC3-saved printer paths are invalid. Either that or there are other reasons to read and write the special format in which AutoCAD's plotter support files are saved.
First,
here's a short description of the PIA (whatever that may stand for) file format.
Secondly, since Zlib streams aren't part of the runtime, I needed to download the
dotnetzip library, in order to reference zlib-v1.9\Ionic.Zlib.dll.
type System.IO.Stream with
member me.WriteString (s : string) =
let buf
= s.
ToCharArray() |> Array.
map byte me.Write(buf, 0, buf.Length)
module Zlib =
open System.IO
open Ionic.Zlib
let read fileName =
use fs = File.Open(fileName, FileMode.Open, FileAccess.Read)
fs.Seek(60L, SeekOrigin.Begin) |> ignore
use zs = new ZlibStream(fs, CompressionMode.Decompress)
use sr = new StreamReader(zs)
let s = sr.ReadToEnd()
sr.Close()
s
let write fileName s =
use fs = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite)
use zs =
new ZlibStream(
fs, CompressionMode.Compress,
CompressionLevel.BestCompression, false )
fs.WriteString(
"PIAFILEVERSION_2.0,CTBVER1,compress\r\npmzlibcodec" +
"\255\255\255\255\255\255\255\000\255\255\255\000" )
zs.WriteString s
zs.Close()
The read function will give you a string which is, to quote, "more or less 'human readable'".