Free Support Forum - groupdocs.com

PDF to WMF conversion - how to pass source file to the .NET API

Hello!
I was trying to covert a pdf that i create with code to the format wmf (if it is not possible, i could use a convertion to plt too). For what i have been seeing, i think that the code to use is the following one:

// Load the PDF file to be converted
var converter = new GroupDocs.Conversion.Converter();
// Set the convert options for WMF format
var convertOptions = converter.GetPossibleConversions()[“wmf”].ConvertOptions;
// Convert to WMF format
converter.Convert(“Saved File.wmf”, convertOptions);

if this is okey, i think the only think i need to know is how to put my pdf that was just created into there. Here is the resumed way i create my pdf document.

PdfDocument document1 = new PdfDocument();
PdfPage page = document1.Pages.Add();
PdfGraphics graphics = page.Graphics;
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 16);
PdfLightTable pdfTable = new PdfLightTable();
graphics.DrawString($“Here is my pdf info”, font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
MemoryStream xx = new MemoryStream();
document1.Save(xx);
document1.Close(true);
await JS.SaveAs(“ETOF” + ordenFabricacion.CG_PROD.Trim() + “.pdf”, xx.ToArray());

I dont know if this is possible. The other option i think of is saving the pdf document and then go to the route where was saved and use the convertor to download again but this is not so good.

Thanks and best wishes,

Matias.

@MatiMutz

You have to pass the PDF in Converter class. Now, there are multiple ways you could load a PDF file for example a PDF file could be loaded from a stream. For more details, please have a look at this documentation article.

Please have a look at the supported file formats. API doesn’t support conversion to PLT file format.