mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-11 09:05:33 +01:00
copy changes from develop
This commit is contained in:
38
PDF/samples/Template/src/Template.cpp
Normal file
38
PDF/samples/Template/src/Template.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// main.cpp
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/PDF/XMLTemplate.h"
|
||||
#include "Poco/Path.h"
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
#if defined(POCO_OS_FAMILY_UNIX)
|
||||
const std::string pdfFileName = "${POCO_BASE}/PDF/samples/Template/Report.pdf";
|
||||
const std::string xmlFileName = "${POCO_BASE}/PDF/samples/Template/Template.xml";
|
||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||
const std::string pdfFileName = "%POCO_BASE%/PDF/samples/Template/Report.pdf";
|
||||
const std::string xmlFileName = "%POCO_BASE%/PDF/samples/Template/Template.xml";
|
||||
#endif
|
||||
|
||||
|
||||
using Poco::Path;
|
||||
using Poco::File;
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
Poco::PDF::XMLTemplate xmlTemplate(Path::expand(xmlFileName));
|
||||
xmlTemplate.create(Path::expand(pdfFileName));
|
||||
}
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
std::cerr << "ERROR: " << exc.displayText() << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user