| 1 | // |
|---|---|
| 2 | // main.cpp |
| 3 | // |
| 4 | |
| 5 | |
| 6 | #include "Poco/PDF/XMLTemplate.h" |
| 7 | #include "Poco/Path.h" |
| 8 | #include "Poco/File.h" |
| 9 | #include "Poco/Exception.h" |
| 10 | #include <iostream> |
| 11 | |
| 12 | |
| 13 | #if defined(POCO_OS_FAMILY_UNIX) |
| 14 | const std::string pdfFileName = "${POCO_BASE}/PDF/samples/Template/Report.pdf"; |
| 15 | const std::string xmlFileName = "${POCO_BASE}/PDF/samples/Template/Template.xml"; |
| 16 | #elif defined(POCO_OS_FAMILY_WINDOWS) |
| 17 | const std::string pdfFileName = "%POCO_BASE%/PDF/samples/Template/Report.pdf"; |
| 18 | const std::string xmlFileName = "%POCO_BASE%/PDF/samples/Template/Template.xml"; |
| 19 | #endif |
| 20 | |
| 21 | |
| 22 | using Poco::Path; |
| 23 | using Poco::File; |
| 24 | |
| 25 | |
| 26 | int main(int argc, char** argv) |
| 27 | { |
| 28 | try |
| 29 | { |
| 30 | Poco::PDF::XMLTemplate xmlTemplate(Path::expand(xmlFileName)); |
| 31 | xmlTemplate.create(Path::expand(pdfFileName)); |
| 32 | } |
| 33 | catch (Poco::Exception& exc) |
| 34 | { |
| 35 | std::cerr << "ERROR: "<< exc.displayText() << std::endl; |
| 36 | } |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 |