Image and PDF file size

I am using the FlexCel library to create an excel document, add lines and images to it, and then sending it to the FlexCelPdfExport to create the PDF. 

I noticed that about 2kb of text and 165kb of image made a excel file of 889kb which then became 1.2MB PDF  file.

I created the file with just the text and it comes in at around 19kb   for the excel file.

So with that said, where is the extra file size coming from? 


How can I get the file size of the PDF and the excel down?

thanks!

I guess that the image is being rasterized by FlexCel, and that might be the cause of the size increase.


The only vectorial file format that Excel understands is wmf/emf, so if the image is in other format it will be converted to png, which can have a bigger size. Also the resolution of the rasterizing might be too big, maybe when you do it directly on Excel it is giving the image a lower resolution.

Can you email me both the image and the excel/pdf files flexcel is creating to adrian@tmssoftware.com so I can try to find out more?

Thanks,
   Adrian.

Sure. 

Do you want me to send the files directly to an email (which email?)  of do you want me to send them via the Direct Support option in this site?

The original image is a .jpg

As a side note - when opening excel locally and creating a new file and adding the text and image manually - the file size remains under 300kb (basically its the size of the 165kb image, plus about 4kb or text plus whatever padding the excel file has.)

Weird, jpg files should be put directly into the file, they shouldn't increase the size.


About the files, just send them to adrian@tmssoftware.com and I will take a look.

Hi,

I' ve received the file, thanks. What is happening here is that this image has a different header and FlexCel isn't recognizing it as a jpg. So, as it does with any file format it doesn't recognize, it gets saved as png, which is a bigger file format (but that isn't loosy as JPG is). 

I'll investigate why this image isn't recognized as jpg and let you know later.

For the record, file sizes if I manually make FlexCel recognize this as jpg are:

xlsx: 171kb
pdf: 167kb

by the way, you can manually tell FlexCel that this is a jpg. Using the following code should create small files:


I am thinking that we will have to manually tell Flexcell this is a jpg. 

The file is coming straight from a binary read from the database, so we have the mime type in a separate column, and maybe its lost in the binary header....

I will give the above code a try now


Also, for the specific method you are using there - what row does it specify putting the image into?

As of now, we are using the overload that has a option to set which row it goes into.

Just a follow up. FlexCel checks for a JFIF jpeg, but this is an Exif jpeg.  I imagine it is footage coming raw form a digital camera.


I've modified already the code so FlexCel can now also detect exif and spiff jpegs, and I'll be uploading a build later today. I'll tell you once it is uploaded where to get it.

Hi,


you set the row and column in the "ClientAnchor" part:


This is setting row1, col1.and the final colums where the image will go.

But if you prefer, in a couple of hour I will be uploading a version that will recognize this jpg file, so you won't have to change anything.

Yes, its raw from a digital camera.

Thanks!  I will wait for the link

I've just sent the link. Let me know if it fixes it.


Regards,
   Adrian.