I am sorry I forgot to mention this:
We have a work around. Given our subscription includes Aspose.Words I can add my SVGs to a word document, save and then save again as PDF; interestingly enough, if I don’t do a save to a file system before the transform to PDF, the SVG images are not in the rendered PDF.
Attached is part of our code for the work around logic:
public PdfDocument GeneratePdf(Model.Notification notification, Template template)
{
var wordDoc = MergeNotificationWithTemplate(notification, template);
if (wordDoc == null)
return null;
wordDoc.SetFontAsArial();
string tempWordFileName = null;
// SVG headers / footers need added to the file while it is still in docx. When we hit PDF, we explode on out of memory exceptions.
if (template.Header.FileExtension.ToLower() == "svg" || template.Footer.FileExtension.ToLower() == "svg")
{
var builder = new DocumentBuilder(wordDoc);
var pageWidth = wordDoc.GetPageInfo(0).WidthInPoints;
if (template.Header.FileExtension.ToLower() == "svg")
{
using (var imgStream = new MemoryStream(template.Header.Document))
{
builder.InsertImage(imgStream,
Aspose.Words.Drawing.RelativeHorizontalPosition.Margin,
Math.Max(pageWidth - (2 * template.Header.XPosition) - decimal.ToDouble(template.Header.SVGWidth.Value), 0),
Aspose.Words.Drawing.RelativeVerticalPosition.Margin,
0,
decimal.ToDouble(template.Header.SVGWidth.Value),
decimal.ToDouble(template.Header.SVGHeight.Value),
Aspose.Words.Drawing.WrapType.Square);
}
}
if (template.Footer.FileExtension.ToLower() == "svg")
{
// because the width may be under sized, set a proportion
var widthProportion = pageWidth / decimal.ToDouble(template.Footer.SVGWidth.Value);
using (var imgStream = new MemoryStream(template.Footer.Document))
{
builder.InsertImage(imgStream,
Aspose.Words.Drawing.RelativeHorizontalPosition.Margin,
0,
Aspose.Words.Drawing.RelativeVerticalPosition.BottomMargin,
Math.Max((2 * template.Footer.YPosition) - decimal.ToDouble(template.Footer.SVGHeight.Value), 0),
decimal.ToDouble(template.Footer.SVGWidth.Value),
decimal.ToDouble(template.Footer.SVGHeight.Value),
Aspose.Words.Drawing.WrapType.Square);
}
}
tempWordFileName = $@"C:\Outputs\image\Dev\20220923\test-{notification.ID}.docx";
wordDoc.Save(tempWordFileName);
wordDoc = new WordDocument(tempWordFileName);
}
var stream = new MemoryStream();
wordDoc.Save(stream, Aspose.Words.SaveFormat.Pdf);
var pdf = new PdfDocument(stream, isManagedStream: true);
pdf = AddPDFHeaderFooter(pdf, template, notification);
if (!string.IsNullOrWhiteSpace(tempWordFileName))
File.Delete(tempWordFileName);
return pdf;
}