Reputation: 912
I need to create a software which will create print previews of the documents of following formats: the MS Office documents (.doc(x)
, .ppt(x)
, .xls(x)
), images, .txt
files and PDF files. I have made a working prototype using XPS
files. So basically I do the following: I convert the office files to .xps
using Office Automation and then I render the .xps
documents to images. I simply create XPS files from images and .txt
by adding text or an image to FlowDocument
, then rendering it. But I have found out that there is no way to convert PDF to XPS fast (A document which has 600 pages takes more than 2 minutes to convert and this is totally not suitable). So I am stuck at this point. It seems that I should start over again, using the different file format. Should I rewrite my program using PDF, for example, or is there any other way to accomplish my task? And if I should use PDF, could you, please, suggest me a good PDF C# library to render previews of pages as fast as possible? I tried using Websupergoo's ABCPdf, but it is too slow, because it does not allow me to render the previews to System.Windows.Media.Imaging.BitmapSource
, only System.Drawing.Bitmap
, so I have to convert Bitmap
to BitmapSource
and it takes up a lot of time.
Thanks in advance.
Upvotes: 1
Views: 603
Reputation: 14289
Use Ghostscipt to convert PDF to images. Though, I don't know why you wouldn't just use the PDF. I have used GhostScript for a number of PDF/Image manipulation tasks.
http://www.wibit.net/blog/integrating_ghostscript_c
Ghostscript will output any PDF to images to the settings you specify. I think you can use it as a DLL or as a commandline process.
Upvotes: 1