Does the output in vector format only support SVG?
Are there any plans to support PDF or other formats?
The reason why I hear this kind of thing is
The created barcode is often printed.
However, since SVG is a format for displaying on the WEB, it only supports RGB.
I would like to know if there is a way to output in CMYK mode.
Aspose.BarCode does support to render in vector format like EMF, PNG, etc., so you may choose one for your needs. See the document on supported file formats for your reference.
Regarding rendering barcode to PDF, you may do that easily. You can generate barcode using Aspose.BarCode API and use Aspose.PDF to add an empty document page and insert the generated barcode image to it. See the document on how to add barcode image to the PDF document for your reference.
EMF is a vector image, isn’t it? Isn’t PNG a raster image?
Thank you for the document link.
I tried it, but when I embedded it in PDF, it changed from vector to raster.
However, it seems that CMYK for printing cannot output.
When printing as black, it must be C0, M0, Y0, K100.
If all are 100, the colors will overlap and be printed.
As mentioned above, is there a way to change to K100 only or to grayscale?
Should I ask this in Aspose.PDF?
EMF is vector image but it uses RGB colors for all vector shapes and text
[[MS-WMF]:Windows Metafile Format]
2.2.2.8 ColorRef Object
The ColorRef Object defines the RGB color.
CMYK colors are currently supported by TiffInCmyk, but tiff is raster image. Also TiffInCmyk is supported only in Windows, in Linux it is saved as ordinary Tiff.
I was referring to the following URL, I was taught from you.
The source is as follows.
var generator = new BarcodeGenerator(EncodeTypes.GS1Code128, barcode);
generator.Parameters.Barcode.XDimension.Millimeters = 1f;
var ms = new MemoryStream();
generator.Save(ms, BarCodeImageFormat.Emf);
var doc = new Aspose.Pdf.Document();
var page = doc.Pages.Add();
var mender = new PdfFileMend();
mender.BindPdf(doc);
mender.AddImage(ms, 1, 100, 600, 200, 700);
mender.Save(Path.Combine(Path.GetDirectoryName(outPath), "AddImage_out.pdf"));
mender.Close();
If you look at the finished PDF, you can see that the image is rough and the bar code is a raster image.
There seems to be no problem if the raster is 1200dpi or higher.
The file size is likely to increase.
Is 22Q1 the ID of the question that was different from me?
Certainly, I was able to create a PDF in vector format there.
However, although I was able to convert to PDF in CMYK mode, I was not able to change the actual CMYK values.
When printing with one black color, I want the CMY value to be 0.
@yuya,
We have logged a ticket for Barcode image generation as CMYK PDF in our database. You will be notified here once any update is ready for sharing.
This feature request is logged as: BARCODENET-37926 - Barcode image generation as CMYK PDF
We are preparing solution for embedding vector image into PDF and will share it soon.
To solve your problem, I should describe some technical information:
Pdf format doesn’t embed vector images it can embed only raster images with different compression. Pdf supports vector drawing but this drawing has different format from other vector formats and other vector formats cannot be converted to pdf vector paths automatically.
In this way, Aspose.PDF converts any images from vector formats into the raster image format and add it in RGB colors (yes, the theoretical possibility to translate one vector format into pdf vector shapes exists, but it is not implemented in Aspose.PDF).
Also, images, which have CMYK colors, are converted into RGB by Aspose.PDF. So, it is no sense to create image in CMYK because it will be converted into RGB.
Aspose.PDF support many pdf formats, one of them is PDF/X−1a. This format is developed only for printing and supports only CMYK colors. So, if you create pdf document in this format all RGB colors is converted into CMYK colors.
The best solution before Aspose.Barcode which can generate barcode in pdf format (this could happen in first quarter of 2022) to create barcode images in pdf in CMYK can be:
Create barcode image in RGB in format without compression or with lossless compression with high resolution
Add it to pdf document as RGB image
Save the pdf document as PDF/X−1a
Here is the code which demonstrates the solution:
string filename = @"d:\save\rec\test.pdf";
var generator = new BarcodeGenerator(EncodeTypes.Code128, "123456");
// resolution is 300 dpi, can be more
generator.Parameters.Resolution = 300;
generator.Parameters.Barcode.XDimension.Millimeters = 1f;
MemoryStream ms = new MemoryStream();
// save in BMP because Aspose.PDF convert all images into RGB in any way
// in this way CMYK image also is converted into RGB image
// also you can try png or tiff becaue them has lossless compression
generator.Save(ms, BarCodeImageFormat.Bmp);
ms.Position = 0;
Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
Aspose.Pdf.Page page = doc.Pages.Add();
Aspose.Pdf.Facades.PdfFileMend mender = new Aspose.Pdf.Facades.PdfFileMend();
mender.BindPdf(doc);
// ImageFilterType.CCITTFax is lossless compression compatible with CMYK. It is developed for CMYK colors
// Jpeg is lossy compression also can use lossless LZW compression. Compatible with CMYK
// ImageFilterType.Flate is also lossless compression. Does not compatible with CMYK.
// Jpeg2000 is lossy compression but it is based on Wavelet and can be lossless. Does not compatible with CMYK.
mender.AddImage(ms, 1, 100, 600, 200, 700, new Aspose.Pdf.CompositingParameters(BlendMode.Normal, ImageFilterType.CCITTFax));
// convert into printing pdf with CMYK colors
// all RGB images are converted to CMYK colors
doc.Convert(new Aspose.Pdf.PdfFormatConversionOptions(PdfFormat.PDF_X_1A));
mender.Save(filename);
mender.Close();
Aspose.Barcode may be available in the first quarter of 2022.
That’s a pleasure.
It’s coming soon, so I’m looking forward to it.
I didn’t know that vector images in PDF are in a different format than other vector images.
Is it Adobe’s own specification?
The high-resolution, uncompressed raster image presented
Is there any problem in printing by saving as PDF in CMYK format?
I will check with the printing staff of the company.
Yes. PDF 1.7 specification is free, 2.0 is standardized by ISO (it has very few differences from 1.7) and this specification is not free, but without any royalties. https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdf_reference_archive/pdf_reference_1-7.pdf https://www.iso.org/standard/75839.html
The high-resolution, uncompressed raster image presented
Is there any problem in printing by saving as PDF in CMYK format?
I am not too common with professional printing and their requirements, but [PDF/X−1a] format is created strongly for professional printing from pdf. And I checked the file, generated but upper code, with Adobe Acrobat, it shows that it is fully [PDF/X−1a] compliant.