Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active February 4, 2022 13:40
How To Render XslFo To PDF using C++. For further details, refer to topic: https://kb.aspose.com/pdf/cpp/how-to-render-xslfo-to-pdf-file-using-c++/
#pragma once
#include <iostream>
#include <system/smart_ptr.h>
#include <Aspose.PDF.Cpp/License.h>
#include <Aspose.PDF.Cpp/Document.h>
#include <Aspose.PDF.Cpp/XslFoLoadOptions.h>
using namespace System;
using namespace Aspose::Pdf;
class XSLFOEx {
public:
static void ConvertXslFo()
{
// Set the license for Aspose.PDF for CPP to create PDF from XSL FO file
SharedPtr<License> XSLFOtoPDFLicense = System::MakeObject<License>();
XSLFOtoPDFLicense->SetLicense(u"Aspose.PDF.NET.lic");
// Create an instance of the XslFoLoadOptions class
SharedPtr<XslFoLoadOptions> options = MakeObject<XslFoLoadOptions>();
// Load the input XSL FO file
SharedPtr<Document> InputXSLFODocument = MakeObject<Document>(u"InputXSLFODocument.fo", options);
// Save the XSL FO document as PDF file
InputXSLFODocument->Save(u"OutputPDFConvertedFromXSLFOFile.pdf");
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment