Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, July 18, 2010 7:42:15 PM(UTC)
Wayne Mather

Groups: Registered
Posts: 2


Hi,

We have only licensed the 1D Barcode Module and Imaging Pro SDK.

This has suited our purpose but now I have an issue where I need to save a CCITT stream from a PDF and process it into several JPG images.

I have looked at the examples and each time I try to either load or convert the stream it gives an invalid file format.

example code:

static void Main(string[] args)
        {
            string src = @"C:\temp\stream.tif";

            Console.WriteLine("Loading src into memory stream....");
            byte[] b = File.ReadAllBytes(src);
            MemoryStream ip = new MemoryStream(b);
            MemoryStream op = new MemoryStream();

            Console.WriteLine("Trying to process stream now");
            try
            {
                RasterSupport.Unlock(RasterSupportType.Pro, "xxx-xxx-xxx-xxx");
                RasterCodecs.Startup();
                RasterCodecs codecs = new RasterCodecs();
                Console.WriteLine("Leadtools initialised....");
                Console.WriteLine("Trying to read information....");
                CodecsImageInfo info = codecs.GetInformation(src, true);
                Console.WriteLine("Have Format: " + info.Format.ToString() + "....");
            }catch(Exception ex)
            {
                Console.WriteLine("Exception: " + ex.Message);
            }
            Console.WriteLine("Press any key");
            Console.ReadKey();
        }

Output:

Loading src into memory stream....
Trying to process stream now
Leadtools initialised....
Trying to read information....
Exception: Invalid file format
Press any key

The TIFF file is directly from the PDF object (I save the bytes)

/Type /XObject
/Subtype /Image
/Width 2340
/Height 1654
/BitsPerComponent 1
/ColorSpace /DeviceGray
/Filter /CCITTFaxDecode /DecodeParms << /K -1 /Columns 2340 >>
/Length 50963

Any code example or where to look for further information.

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, July 19, 2010 5:11:56 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

The error "Invalid File Format normally means that you did not include the file format DLL in your application. For example, if you want to load/save a BMP file, you need to include the Leadtools.Codecs.BMP.dll in your project/application. If you are loading or saving a TIFF CCITT Group4 file, you need to include the Leadtools.Codecs.Fax.dll and Leadtools.Codecs.Tif.dll.

For more information, please check the help topic "Files to be Included with Your Application".

Please note that the unlock serial (format xxxxxxxxxx) used for the RasterSupport.Unlock method is NOT the same install or ownership serial (xxxx-xxxx-xxxx-xxxx).
If you don't have unlock key string, you need to contact licensing@LEADTOOLS.com to sign a royalty deployment agreement.
 
#3 Posted : Monday, July 19, 2010 2:45:30 PM(UTC)
Wayne Mather

Groups: Registered
Posts: 2


Thanks Adam,

I have email Samantha to provide the unlock key as we have paid the licensing for Imaging PRO SDK & 1D Barcodes but was only supplied with the 1D barcode unlock key.

At least I am on the right track then and that your software should be able to decode and convert the CCITT G4 bytes.

This is the first 39 bytes of the file exported from the PDF stream:

0x00: 20 2e 2a 1b ff fe 55 a8 ca 85 65 00 b9 c6 54 2b
0x10: 28 05 ce 32 a1 59 40 2e 7e 32 ad 78 ca b5 ec a0
0x20: 17 a2 51 95 6b c6 55 af 65 00 bd 12 8c ab 5e 32
0x30: a1 59 40 2e 76 50 0b d1 28 ca b5 e3 2a 15 94 02

My understanding is that this is the raw compressed/encoded multi paged TIFF file? I cannot identify this tiff using the Win32 port of LibTiff. TiffDump says not a valid TIFF or MDIE file, bad magic number 11808 (0x2e20).

I don't think your tools are going to help me if I cannot identify the stream of bytes. I will now take a step back and try to identify the stream and how to decode/deflat/decrypt the information.

Thank you for your support any way


 
#4 Posted : Tuesday, July 20, 2010 4:41:48 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Wayne,
Here are some facts about how our toolkit works with G4-compressed images and PDF files:
1. Our toolkit can open a raw CCITT G4 image even if it's not part of a TIFF file with a complete TIFF header. However, without the TIFF header (or a different header for an image format that supports G4), you cannot use direct loading and must instead use the raw loading approach. This approach is shown in our main C# demo in the File-> Open Raw menu.

2. Our toolkit does not have functions that tell you where the image location is inside a PDF file or stream. This means if you decide to use the raw loading approach, it will be your responsibility to supply a valid file or buffer that contains the correct raw data and its properties (width, height, compression types, etc.)

3. Please note that our PDF plug-in can load PDF pages as images, including any embedded images in that page. If you use the plug-in, the whole PDF page is rasterized as one bitmap image. For more information, please see the following page:
http://leadtools.com/sdk/pdf/default.htm
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.251 seconds.