Free Support Forum - aspose.com

SVG to Aspose Image to be passed to StampAnnotation

Does Aspose.PDF support this?


i have an SVG file and i would like to pass that to a StampAnnotation object

Hi Chit,


Thanks for contacting support.

Aspose.Pdf for .NET supports the feature to convert add SVG image to PDF file and it also provides the capabilities to Add SVG Object to Table Cell. But I am afraid currently it does not support the feature to use SVG as StampAnnotation. However as a workaround, you may consider Converting SVG To Raster Format using Aspose.Imaging for .NET and then Add Image Stamp in PDF File using Aspose.Pdf for .NET.

Should you have any further query, please feel free to contact.

ok thank you for the info.


but that is not considered a workaround because a stamp annotation is not the same an image stamp.


ill look for some other alternative

Hi Chit,


Thanks for sharing the details.

Currently the StampAnnotation class supports PNG and JPEG images but currently it does not support SVG images. However for the sake of correction, I have logged this enhancement request as PDFNET-42444 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

Hello,

I also need this, 4 years later what is the status of this demand ?

Thanks

im afraid this may not even be possible for them since they need to add more libraries for image processing.

what i did was use 3rd party libraries that output svg to inputstream, then you use that to pass to stamp annotation.

@chitgoks, @tfipsrd

We thank you for your patience and would like to share with you that support of SVG image in StampAnnotation was added in the API. Please use following code snippet with Aspose.PDF for .NET 20.12 and let us know if you still face any issue:

Document doc = new Document();
doc.Pages.Add();
Aspose.Pdf.Annotations.StampAnnotation stamp = new Aspose.Pdf.Annotations.StampAnnotation(doc.Pages[1], new Aspose.Pdf.Rectangle(10,10,100,100));
stamp.Image = new FileStream("input.svg", FileMode.Open);
doc.Pages[1].Annotations.Add(stamp);
doc.Save("stampannotation.pdf");
1 Like

The stream can be a svg file, but at the end, in the pdf, it will be transformed into a bitmap.
That’s not what I expected. I need to pass an svg and save it in the pdf as an svg to keep the quality.

@tfipsrd

We will surely investigate the feasibility of your requirements. However, could you please provide a sample SVG file along with expected output PDF. We will test the scenario in our environment and address it accordingly.