Free Support Forum - aspose.com

PDF to EMF gives out of memory exception (Very Urgent)

Hi,

While I am converting from PDF to EMF bytestream, the bytestream size gets so huge that the application ends up with throwing outof memory exception.

converter.BindPdf("path");

converter.DoConvert();

int i=0;

byte[] myBytes=new byte[len];

while (converter.HasNextImage())

{

MemoryStream msAsposeEmf = new MemoryStream();

converter.GetNextImage(msAspose, ImageFormat.Emf);

myBytes[i]= msAspose.ToArray();

}

In the above code sample, the size of each myBytes becomes very huge. Please help me out.

Hi,

Please share the input PDF file with us, so we could investigate the issue at our end. You’ll be updated with the results accordingly.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

Hi Shahzad,

I have attached a very small sized pdf file that contains only one line of text.

Please check why this also generated a huge bytestream for emf.

Thanks

Hi Shahzad,

I have attached a sample pdf file which contains only a single text line. But still a huge sized emf byte array created for this file too while converting.

Please check and let me know as soon as possible.

Thanks for your support.

Hi,

I have tested this issue at my end using the attached sample file and produced an output EMF image of size about 8 MB. Is this the size you’re getting at your end? I would like to share with you that the image size is going to be larger as compared to the PDF file size due to the way the data and information is presented. I have tried other image formats like GIF (8 KB) and JPEG (45 KB), which have much lower file size. Do you think other file format type might work in your scenario? Please share your thoughts.

We’re sorry for the inconvenience.
Regards,

Hi,

Thanks for your reply first.

It is generating around same huge size at our end too.

Actually we want only in emf format. That is for printing purpose. We could have used other formats like jpeg, but the print quality is not as good as with emf. We can use the prinitng stuff internally from pdf also. Then print quality is good, but main problem is to ship the big size dll (Aspose.Pdf) with the client application. Alternatively do you provide any tiny dll that we can use in client application only for printing purpose either through pdf or emf.

Thank you.

Hi,

I’m sorry to inform you that it is not feasible for us to provide a DLL that is smaller than our usual DLL. However, I have logged an issue in our issue tracking system as PDFKITNET-28599 in order to investigate whether we can provide some improvement to reduce the size of the output EMF file. Nevertheless, this issue might take some time before it can be resolved.

We’re sorry for the inconvenience. If you find any further questions, please do let us know.
Regards,

Hi,

Could you provide some format that will produce same print quality as EMF does. We tried using PNG, but it is not at all clear while printing.

Thanks

Hi,

In fact, you need to try to convert the PDF file to other image formats just like you did for EMF images. Also, you need to test these different image output files using your particular PDF files to see whether it can satisfy your needs. However, as far EMF related issue is concerned, I have already logged it at my end as shared in my previous post.

If you find any further questions, please do let us know.
Regards,