diff options
author | Tobias Hoffmann <thobi@worker> | 2012-06-27 06:00:58 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2012-06-27 16:19:57 +0200 |
commit | 43c404b45ab54583a33492adc93f54fa349c2f94 (patch) | |
tree | da195c74239078c5a52b3f7be4c2477d6eea9f0b /examples/pdf-create.cc | |
parent | 75054c0b9404572f2c1477858fe47a61404b72f5 (diff) | |
download | qpdf-43c404b45ab54583a33492adc93f54fa349c2f94.tar.zst |
Add QPDFObjectHandle::newStream(QPDF *, std::string const&)
This makes the code simpler than having to create a buffer of a fixed
size and copy the string to it.
Diffstat (limited to 'examples/pdf-create.cc')
-rw-r--r-- | examples/pdf-create.cc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc index e1a3ddd6..e1d75759 100644 --- a/examples/pdf-create.cc +++ b/examples/pdf-create.cc @@ -65,10 +65,7 @@ static QPDFObjectHandle createPageContents(QPDF& pdf, std::string const& text) std::string contents = "BT /F1 24 Tf 72 720 Td (" + text + ") Tj ET\n" "q 144 0 0 144 234 324 cm /Im1 Do Q\n"; - PointerHolder<Buffer> b = new Buffer(contents.length()); - unsigned char* bp = b->getBuffer(); - memcpy(bp, (char*)contents.c_str(), contents.length()); - return QPDFObjectHandle::newStream(&pdf, b); + return QPDFObjectHandle::newStream(&pdf, contents); } QPDFObjectHandle newName(std::string const& name) |