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

Free Support Forum - aspose.com

How to embed a vector image in PDF as it is in vector format

Hi. I want to embed an emf image in a PDF using Aspose.PDF.

When embedding an emf image in PDF with AddImage of PdfFileMend
emf is an image in vector format, but when embedded in PDF, it became a raster image.

Is there a way to save the image in PDF as it is in vector format?

Best regard.

The sources I couldn’t convert to CMYK are:


    var generator = new BarcodeGenerator(EncodeTypes.GS1Code128, barcode);
    generator.Parameters.Barcode.XDimension.Millimeters = 1f;
    generator.Save(outPath, BarCodeImageFormat.Emf);

    var pdfFile = Path.Combine(Path.GetDirectoryName(outPath), Path.GetFileNameWithoutExtension(outPath) + "_pdf.pdf");
    using (var image = Aspose.Imaging.Image.Load(outPath))
    {
        var pdfOptions = new PdfOptions();
        image.Save(pdfFile, pdfOptions);
    }

    var doc = new Aspose.Pdf.Document(pdfFile);
    doc.Convert(Path.Combine(Path.GetDirectoryName(outPath), "logfile.log"), PdfFormat.PDF_X_1A, ConvertErrorAction.Delete);

@yuya

The code shared by you is converting the EMF image to PDF with Aspose.Imaging but you have mentioned embedding an emf image in PDF with AddImage of PdfFileMend. I request you to share that code and the EMF image so that we may try to reproduce the same on our end.

Thank you for your reply.

sorry. It seems that I had paste a different source because I tried variously.

PdfFilemend
A vector format image when embedding an EMF image in PDF using EMF ADDIMAGE, but it became a raster image when embedded in PDF.
As of the sentence, it has become a raster if this is

As of the source being pasted,
Output EMF files with PDF in ASPOSE.IMG, and convert PDF as it is in vector format.

So this question will be closed.
We apologize for any inconvenience.

@yuya

Thanks for your feedback. We have closed the thread.

1 Like