get Filesize during building up a OCR-PDF

Discussions about machine vision support in GdPicture.
Post Reply
OLager
Posts: 10
Joined: Tue Sep 07, 2010 8:17 am

get Filesize during building up a OCR-PDF

Post by OLager » Wed Sep 12, 2012 8:05 am

Hi,

with multiple TIF files I'm generate a OCR PDF with "PdfAddGdPictureImageToPdfOCR". Everthing works fine.
One condition is that no file has to become bigger then 10MB. Therefore I always have to know what is the actual filesize of the PDF. If the limit of 10MB is reached, I create a new PDF (01, 02, 03...)

Is there any property which I can use to get the file length or where can I find the temporary PDF?

Thanks Olaf

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: get Filesize during building up a OCR-PDF

Post by Loïc » Wed Sep 12, 2012 9:23 am

Hello Olaf,

The only way is to save the current PDF into a memory stream and get the stream size.

Kind regards,

Loïc

OLager
Posts: 10
Joined: Tue Sep 07, 2010 8:17 am

Re: get Filesize during building up a OCR-PDF

Post by OLager » Wed Sep 12, 2012 10:21 am

Hello Loïc,

thanks a lot for fast response.

Stream... OK. But how can I save the hole PDF to a stream? I set the jpg quality to a low level. Therefore a have to know the size of the hole pdf and not the sum of all the images.
I only find the possibility to save one image to a stream, not for a PDF.

maybe you have an example for me?

Thanks Olaf

OLager
Posts: 10
Joined: Tue Sep 07, 2010 8:17 am

Re: get Filesize during building up a OCR-PDF

Post by OLager » Thu Sep 13, 2012 6:34 am

Maybe at least a short hint?
Can i Use gdpicture to save the stream or have I to use system.io? In gdpicture I only find methods to save ONE Image...

OLager
Posts: 10
Joined: Tue Sep 07, 2010 8:17 am

Re: get Filesize during building up a OCR-PDF

Post by OLager » Fri Sep 14, 2012 7:56 am

Hi Loïc,

I realised, that I have posted in the wrong topic. Maybe you can move this thread in the topic "GdPicture Tesseract OCR Engine Plugin". Maybe someone else than help me.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: get Filesize during building up a OCR-PDF

Post by Loïc » Mon Sep 17, 2012 2:01 pm

Hello Olaf,

After further investigations I realized that it was not really accurate way to anticipate the actual PDF size.

The only workaround I can see is:

- Create one PDF/OCR by page.
- With the GdPicturePDF class, merge a number of created files to do not exceed your limitation.

This looks a little messy but unfortunately I have no other workaround in mind.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest