We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Vector Graphics in Aspose.Barcode

Dear Aspose team!

Obviously, I ran into the same problem already found in System.ArgumentNullException: Value cannot be null.
Parameter name: encoder
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at Aqdb.BatchDocConverter.BarCode.BarCodeServiceAdapter.GetImageBytes(Image image, ImageFormat imageFormat) in C:\Solutions\Branches\2.1.0\POC\PDF_PS_in_one_go\Aqdb.BDC\Source\BatchDocConverter.BarCode\BarCodeServiceAdapter.cs:line 148
at Aqdb.BatchDocConverter.BarCode.BarCodeServiceAdapter.GenerateBarCode(GenerateBarCodeRequest input) in C:\Solutions\Branches\2.1.0\POC\PDF_PS_in_one_go\Aqdb.BDC\Source\BatchDocConverter.BarCode\BarCodeServiceAdapter.cs:line 69

Our implementation looks like this:

var imageFormat = GetConfiguredImageFormat();
var imageQuality = GetConfiguredImageQualityMode();

barcodeBuilder.ImageQuality = imageQuality;
var image = barcodeBuilder.BarCodeImage;
image.RotateFlip(input.Rotation);

if (dpi > 0)
{
image.SetResolution(dpi, dpi);
}

response.Image = GetImageBytes(image, imageFormat);

with GetImageBytes() saving in specified vector graphigs format:

System.Drawing.Image image;

byte[] result;

using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, imageFormat);
result = ms.ToArray();
ms.Flush();
ms.Close();
}

I can imagine that Aspose saves as bitmap and hence it's impossible for the Image class to decompose the image binary into vectors. But BarcodeBuilder#Save() did not help either.

Do you know how we can solve this problem?

Thanks in advance for your great support!

Cheers,

Stephan

Hi Stephan,


Thanks for your inquiry.

There are some problems while saving the barcode image to stream in EMF format. This issue is not yet resolved. I will try to get back to you with more information. Sorry for the inconvenience.

Hi Saqib!

Thanks for your reply!

Does the problem also concern WMF (or EMF only)?

Would it be possible to estimate when the issue could be fixed?

Thanks again,

cheers,

Stephan

Hi Stephan,


This exception occurs while saving barcode images in EMF or WMF formats as these are not supported by the .NET framework. Please refer to http://support.microsoft.com/kb/316563 article for further details. If you save it to disk using the below statement, it actually saves the image in PNG format.

builder.Save(“test.emf”, ImageFormat.Emf); // works

It would take some time to provide an alternate solution for saving images in EMF format.

Is it possible for you to use other formats for saving images e.g. PNG or JPG?

Hi Saqib!

Thanks, I'll try BarcodeBuilder again.

Currently, we're investigating how we can improve the barcode quality when inserting the images into a Word document (by Aspose.Word) and then converting this to PDF (using non-Aspose-components like Acrobat destiller, save-as-PDF in Word ).

Image formats as BMP, PNG and especially JPEG sometimes cause results that are not usable.

GIF even seems to destroy the barcodes by spreading them across the document horizontally.

We already changed Word settings (suppressing compression at save, standard optimization) but this did not help.

Using vector graphics could help, couldn't it?

Please find attached some examples:

- the original Word document tmp000000010018972.docx (image quality is OK)

- PNG_default_pdf.pdf which uses PNG with default quality and PDF as taget format (not PDFA!)

- PNG_antialias_pdf.pdf which uses PNG with antialias quality and PDF as taget format (not PDFA!)

Do you know what our problem could be?

Thank you very much for your efforts,

cheers,

Stephan

The issues you have found earlier (filed as 15355) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)