Open files without a file extension?

Jul 29, 2014 at 6:07 PM
I have a program that saves files without a file extension. ex... c:\temp\f9df68ab-5ee3-43d5-9c5e-f080ab873186

How can I open that file? _rasterizer.Open(Source, _lastInstalledVersion, false);
Jul 29, 2014 at 6:46 PM
Hi Geiger,

You can pass MemoryStream as source if you don't know the extension. Ghostscript.NET will figure out the file format.

Something like:
            byte[] buffer = File.ReadAllBytes(Source);
            MemoryStream ms = new MemoryStream(buffer);

            _rasterizer.Open(ms, _lastInstalledVersion, false);
Jul 30, 2014 at 8:44 AM
Version 1.1.9 was released a moment a go and it has this fixed so you can now pass the file path without extension and it should work.

You can download last release from:
Jul 30, 2014 at 1:25 PM
That is a very quick turn around!

I think this brings up a different issue though. StreamHelper.cs does not recognize the PDF as a valid format. (Line 83).

If I force it to be a pdf instead of throwing an error and it properly works then.
Jul 30, 2014 at 1:48 PM
Can you please send me (drop box or similar file sharing service) the pdf file you were trying to use and it was not recognized as a valid format so I can debug it?

or simply email it to me directly to:
Jul 30, 2014 at 2:49 PM
I can't do that because it is a 24 page bill with a lot of personal information on it.

I got around it by copying it to a file called temp.pdf and loading that. Using the memory stream didn't work for this one specific file. It only works if it has a file name with a .PDF extension.

Thank you for your help. Sorry I can't send out the sample PDF.
Jul 30, 2014 at 3:02 PM
No worries.

Can you please open that pdf in some hex editor (you can use Visual Studio to open pdf as binary file) and send a screenshot of binary data (first 30 bytes)? This will not show any sensitive content and it will help me to figure out what's going on.

Jul 31, 2014 at 7:58 AM
Thanks for the hex output.

This problem is sorted out in this commit: