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

Free Support Forum - aspose.com

Image quality issues in Barcode generation to PDF

Hello,

Used the below code snippet to convert barcode to PDF. If the barcode is converted directly to PDF or jpg, the image is getting distorted if the image is zoomed to 500%+.
So, converted the barcode to svg and svg is converted to PDF. In the PDF the barcode numbers are not properly visible. The expectation is - the output should be PDF, image quality should not be distorted if magnified (Vector Image) and Barcode should be clearly visible. Please let us know if the result is the same with licensed version also. If so please help us to rectify the issue.

Code snippet:
void geneateBarcode(std::string encType, System::String code, System::String pdfFile, System::String svgFile)
{
try
{

	// Instantiate barcode object and set differnt barcode properties
	System::SharedPtr<BarcodeGenerator> generator = System::MakeObject<BarcodeGenerator>(EncodeTypes::Code39Standard, code);

	// Save the image to your system and set its image format to Jpeg
	generator->Save(svgFile);
	auto pdf = MakeObject<Aspose::Pdf::Document>(svgFile, MakeObject<SvgLoadOptions>());
	
	pdf->Save(pdfFile);		

}

Result files:Asset.7z (126.8 KB)

Thanks,
Janci

Code snippet:

@Janci,

I am not sure if the issue is in the SVG to PDF module (by Aspose.PDF) as the SVG file looks ok when viewed. Did you check the SVG file by Aspose.BarCode, is it not right? Anyways, could you please create a standalone (runnable) VS.NET project using latest version of Aspose.BarCode for C++ v22.6.0 and Aspose.PDF for C++ v22.6.0, zip the project and post us to reproduce the issue on our end. We will check your issue soon.

It is better you use a temporary license to work with the APIs with full capacity. If you want to test Aspose APIs without evaluation version limitations, you may request a 30-day temporary license. Please refer to How to get a Temporary License? for more information.

Hi,

Can you please guide me in getting temporary license?
I followed the steps mentioned in the link " How to get a Temporary License?" But it is always taking me to the page to buy the product.

Thanks,
Janci

@Janci,

You can request a temporary license by adding products to your cart in the purchase wizard.

After you have added your desired product to chart, click on Cart tab and you will find “Get a temporary license” button on the right panel on the page. Click the button to request the temporary license via email. After a few minutes, you should get an email with temporary license as attachment.

Should you have any issue in getting temporary license, please contact our sales team in Aspose.Purchase section.

At first SVG and EMF are vector formats. PDF also have own embedded vector format but it cannot be converted in automatic mode from SVG or EMF. In this way, all images from vector formats are converted to embedded JPG (can be in lossless JPG). This is not Aspose.PDF behavior but it is PDF standard which does not allow to embed any other vector formats into.

We have plans to implement barcode generation in PDF vector format directly but we do not have ETA, so they are just plans.

In this way you can create PDF document and embed image (PNG with 300+dpi resolution) into the document. Currently we have updated documentation for .NET, how to do this. But we don’t have for C++. However, it is not difficult to understand by C# code how to implement this for C++ code.