Convert OFD, EPS, and PCL to PDF in C++

Load OFD, EPS, and PCL files with format-specific options and save them as PDF.

Configure the Aspose.PDF for C++ SDK before running these functions. Pass an existing input file and a writable destination path; create any required output directories first. Each function is an independent example, and its options do not carry over to other examples.

For text, LaTeX, Markdown, PostScript, XPS, and XML with XSL-FO, see Convert Other File Formats to PDF.

Convert OFD to PDF

Use OfdLoadOptions to load the OFD document.

  1. Create OfdLoadOptions.
  2. Load inputFile into a Document using the load options.
  3. Save the result with Document::Save().
#include <Aspose.PDF.Cpp/Document.h>
#include <Aspose.PDF.Cpp/OFD/OfdLoadOptions.h>

namespace ConvertingExamples
{
	using namespace System;
	using namespace Aspose::Pdf;

	void ConvertOfdToPdf(String inputFile, String outputFile)
	{
		auto options = MakeObject<OfdLoadOptions>();
		auto document = MakeObject<Document>(inputFile, options);
		document->Save(outputFile);
	}
}

Convert EPS to PDF

Use PsLoadOptions to load the Encapsulated PostScript document.

  1. Create PsLoadOptions.
  2. Load inputFile into a Document using the load options.
  3. Save the result with Document::Save().
#include <Aspose.PDF.Cpp/Document.h>
#include <Aspose.PDF.Cpp/PsLoadOptions.h>

namespace ConvertingExamples
{
	using namespace System;
	using namespace Aspose::Pdf;

	void ConvertEpsToPdf(String inputFile, String outputFile)
	{
		auto options = MakeObject<PsLoadOptions>();
		auto document = MakeObject<Document>(inputFile, options);
		document->Save(outputFile);
	}
}

Convert PCL to PDF

Set PclLoadOptions::SupressErrors to true before loading the PCL file. The supplied example suppresses PCL conversion errors.

  1. Create PclLoadOptions.
  2. Set SupressErrors to true in PclLoadOptions.
  3. Load inputFile into a Document using the load options.
  4. Save the result with Document::Save().
#include <Aspose.PDF.Cpp/Document.h>
#include <Aspose.PDF.Cpp/PclLoadOptions.h>

namespace ConvertingExamples
{
	using namespace System;
	using namespace Aspose::Pdf;

	void ConvertPclToPdf(String inputFile, String outputFile)
	{
		auto options = MakeObject<PclLoadOptions>();
		options->SupressErrors = true;
		auto document = MakeObject<Document>(inputFile, options);
		document->Save(outputFile);
	}
}