XPS to TIFF

In the last post, I described how to convert a PDF into XPS as an intermediate step to split out and convert the individual pages to TIFF format.  Our goal is to combine single page TIFF pages back into their original form where multiple page documents are held in a single file.  We have to do this since the health providers insist on sending us our health records combined into a single PDF file.

This post is geek-speak.  If you don’t know C# and .NET, forget it.  Just skip to the bottom and pull down the tool if you want.

The first step is to open the XPS file and to print the individual pages as single page TIFF files.

We create a new XpsDocument object to hold our XPS file.  Next, we get the number of pages and walk the stack of pages one at a time and save each one as a new TIFF file.

image

Now, the toolset become pretty crude.  For my sample PDF file of 877 pages, I should now have 877 TIFF files in a directory and I can use the Windows File Explorer and an image viewer to sort, delete, and combine the files.  I find that the Windows Photo Viewer application works well.

The tool (download source or object below), allows me to drag the pages that should be combined into a single TIFF file.  It then (optionally) deletes the original files.

Therefore, this process may look something like:  a) walk the files using Explorer and the Windows Photo Viewer and delete files we don’t want to keep; b) when we find a file we want, walk the individual TIFF files until we see the last page we want to combine into a single saved TIFF file; c) grab all the individual TIFF files and drop them on the application from below; d) make sure the pages are in the correct order, resort them if not into the order you want them saved as; e) save the pages into a new single TIFF file that contains one or more pages.

As I say, this process is a bit rough and the code and tool are not “production” applications; but, I post them here as reference for someone else who may want to use the logic and improve the functionality to meet their needs.

Of course, all of this would be much simpler if the health care institutions would comply with the federal regs (45 C.F.R. § 164.524) where it says:

(i) The covered entity must provide the individual with access to the protected health information in the form or format requested by the individual, if it is readily producible in such form or format; or, if not, in a readable hard copy form or such other form or format as agreed to by the covered entity and the individual.

Although I have requested my records to be in high-quality multi-page TIFF format; or at least a single TIFF file, this has NEVER happened and they always come in a very low quality PDF.  Nor has the health care institution ever contacted me to see if we could “agree” on the format as per these regulations Sad smile  Hopefully, the magical “blue button” will fix all this; but in the meantime, here’s the full (and still a bit rough) tool set.

The “Document Doctor” or DocDoc – source files here; object (executables) here.

Leave a Reply

Your email address will not be published. Required fields are marked *

two × 2 =