Is there a programming toolkit for converting “any

2019-04-11 19:21发布

问题:

I've written several variations of a program. The purpose of the program is to convert "any file type" to a TIFF image represenation of that file, as if it were being printed using a printer.

I'm currently using a third party printer driver that I send files to, and it outputs a TIFF image. This is nice, but it requires me to use Office Interop files, and interact with each individual processing application in order to print the files.

I had previously tried a toolkit, called Apose .NET, which did not rely on Office Interop, and did not require any printer driver. It did the conversion all on its own and would create a TIFF image. The problem with Aspose .NET was that it did not support a wide variety of input file types. Most notably, it can't do Visio files.

My project calls for the ability to create a TIFF image for virtually "any file type". (excluding exes, music files, and stuff) I know that finding something that handles literally any file type is probably not a very feasible task, so I figure if it can at least handle all the Office file types, Adobe types, and other major standard file types, then I can write a custom extension parsing module that uses those processing applications to do the printing of any file type that can be viewed using those applications.

So, does anyone know of a toolkit that can do this? Preferably one that does not rely on Office or a printer driver. It does not have to be free, or open source. Or, if you know of an amazing printer driver that does this, I'm open to that too.

回答1:

This is an integration project - there is no one tool that will read all of the file types you're interested in. In our case, we developed a generic transcoding service that accepts numerous input types (by file extension) and executes external applications based on that type:

  • Ghostscript for PDF and PS files,
  • ImageMagick for image files,
  • Apose.NET for Office types, and
  • some homegrown stuff for simpler types like text files.

We haven't found an application that will interpret Visio files of all versions other than Visio itself. And as you may already know, Office Interop should not be used on a server.



回答2:

I'd suggest using something like ImageMagick. It handles a variety of source formats.

Your "convert any file type to TIFF" requirement is absurd though.

Converting any image file type to TIFF is fine.

Converting a postscript file to TIFF is fine, though more involved (i.e., something that you can print - set up a postscript printer on your machine and print to file, then convert the .ps to TIFF).

Converting EXEs, MP3s, or other random binary data to TIFF just doesn't make sense (unless you want an TIFF image of a hex dump).



回答3:

  • FreePDF: print anything to PDF (it uses ghostscript in the background)
  • ImageMagick: convert PDF to TIFF

I used the combination to automatically generate the watermarked images for take-heart.nl.
Those images are PNG, but could just as easily have been TIFF.

--jeroen



标签: tiff toolkit