mirror of
https://github.com/qpdf/qpdf.git
synced 2024-05-29 00:10:54 +00:00
Use QPDF::newStream in library
This commit is contained in:
parent
f69ed209d0
commit
743a735ee0
|
@ -2224,7 +2224,7 @@ QPDF::reserveObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top)
|
||||||
obj_copier.to_copy.push_back(foreign);
|
obj_copier.to_copy.push_back(foreign);
|
||||||
QPDFObjectHandle reservation;
|
QPDFObjectHandle reservation;
|
||||||
if (foreign.isStream()) {
|
if (foreign.isStream()) {
|
||||||
reservation = QPDFObjectHandle::newStream(this);
|
reservation = newStream();
|
||||||
} else {
|
} else {
|
||||||
reservation = QPDFObjectHandle::newReserved(this);
|
reservation = QPDFObjectHandle::newReserved(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <qpdf/Pl_Discard.hh>
|
#include <qpdf/Pl_Discard.hh>
|
||||||
#include <qpdf/Pl_MD5.hh>
|
#include <qpdf/Pl_MD5.hh>
|
||||||
#include <qpdf/QIntC.hh>
|
#include <qpdf/QIntC.hh>
|
||||||
|
#include <qpdf/QPDF.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
QPDFEFStreamObjectHelper::QPDFEFStreamObjectHelper(QPDFObjectHandle oh) :
|
QPDFEFStreamObjectHelper::QPDFEFStreamObjectHelper(QPDFObjectHandle oh) :
|
||||||
|
@ -91,20 +92,20 @@ QPDFEFStreamObjectHelper
|
||||||
QPDFEFStreamObjectHelper::createEFStream(
|
QPDFEFStreamObjectHelper::createEFStream(
|
||||||
QPDF& qpdf, std::shared_ptr<Buffer> data)
|
QPDF& qpdf, std::shared_ptr<Buffer> data)
|
||||||
{
|
{
|
||||||
return newFromStream(QPDFObjectHandle::newStream(&qpdf, data));
|
return newFromStream(qpdf.newStream(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
QPDFEFStreamObjectHelper
|
QPDFEFStreamObjectHelper
|
||||||
QPDFEFStreamObjectHelper::createEFStream(QPDF& qpdf, std::string const& data)
|
QPDFEFStreamObjectHelper::createEFStream(QPDF& qpdf, std::string const& data)
|
||||||
{
|
{
|
||||||
return newFromStream(QPDFObjectHandle::newStream(&qpdf, data));
|
return newFromStream(qpdf.newStream(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
QPDFEFStreamObjectHelper
|
QPDFEFStreamObjectHelper
|
||||||
QPDFEFStreamObjectHelper::createEFStream(
|
QPDFEFStreamObjectHelper::createEFStream(
|
||||||
QPDF& qpdf, std::function<void(Pipeline*)> provider)
|
QPDF& qpdf, std::function<void(Pipeline*)> provider)
|
||||||
{
|
{
|
||||||
auto stream = QPDFObjectHandle::newStream(&qpdf);
|
auto stream = qpdf.newStream();
|
||||||
stream.replaceStreamData(
|
stream.replaceStreamData(
|
||||||
provider, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull());
|
provider, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull());
|
||||||
return newFromStream(stream);
|
return newFromStream(stream);
|
||||||
|
|
|
@ -2242,13 +2242,10 @@ QPDFJob::doUnderOverlayForPage(
|
||||||
}
|
}
|
||||||
if (!content.empty()) {
|
if (!content.empty()) {
|
||||||
if (before) {
|
if (before) {
|
||||||
dest_page.addPageContents(
|
dest_page.addPageContents(pdf.newStream(content), true);
|
||||||
QPDFObjectHandle::newStream(&pdf, content), true);
|
|
||||||
} else {
|
} else {
|
||||||
dest_page.addPageContents(
|
dest_page.addPageContents(pdf.newStream("q\n"), true);
|
||||||
QPDFObjectHandle::newStream(&pdf, "q\n"), true);
|
dest_page.addPageContents(pdf.newStream("\nQ\n" + content), false);
|
||||||
dest_page.addPageContents(
|
|
||||||
QPDFObjectHandle::newStream(&pdf, "\nQ\n" + content), false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2473,8 +2470,7 @@ QPDFJob::handleTransformations(QPDF& pdf)
|
||||||
if (io->evaluate(
|
if (io->evaluate(
|
||||||
"image " + name + " on page " +
|
"image " + name + " on page " +
|
||||||
std::to_string(pageno))) {
|
std::to_string(pageno))) {
|
||||||
QPDFObjectHandle new_image =
|
QPDFObjectHandle new_image = pdf.newStream();
|
||||||
QPDFObjectHandle::newStream(&pdf);
|
|
||||||
new_image.replaceDict(image.getDict().shallowCopy());
|
new_image.replaceDict(image.getDict().shallowCopy());
|
||||||
new_image.replaceStreamData(
|
new_image.replaceStreamData(
|
||||||
sdp,
|
sdp,
|
||||||
|
|
|
@ -163,8 +163,7 @@ QPDFPageDocumentHelper::flattenAnnotationsForPage(
|
||||||
page_oh.replaceKey("/Annots", new_annots_oh);
|
page_oh.replaceKey("/Annots", new_annots_oh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
page.addPageContents(QPDFObjectHandle::newStream(&qpdf, "q\n"), true);
|
page.addPageContents(qpdf.newStream("q\n"), true);
|
||||||
page.addPageContents(
|
page.addPageContents(qpdf.newStream("\nQ\n" + new_content), false);
|
||||||
QPDFObjectHandle::newStream(&qpdf, "\nQ\n" + new_content), false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -785,10 +785,10 @@ QPDFPageObjectHelper::getMatrixForTransformations(bool invert)
|
||||||
QPDFObjectHandle
|
QPDFObjectHandle
|
||||||
QPDFPageObjectHelper::getFormXObjectForPage(bool handle_transformations)
|
QPDFPageObjectHelper::getFormXObjectForPage(bool handle_transformations)
|
||||||
{
|
{
|
||||||
QPDF& qpdf = this->oh.getQPDF(
|
auto result = this->oh
|
||||||
"QPDFPageObjectHelper::getFormXObjectForPage called with a direct "
|
.getQPDF("QPDFPageObjectHelper::getFormXObjectForPage "
|
||||||
"object");
|
"called with a direct object")
|
||||||
QPDFObjectHandle result = QPDFObjectHandle::newStream(&qpdf);
|
.newStream();
|
||||||
QPDFObjectHandle newdict = result.getDict();
|
QPDFObjectHandle newdict = result.getDict();
|
||||||
newdict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"));
|
newdict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"));
|
||||||
newdict.replaceKey("/Subtype", QPDFObjectHandle::newName("/Form"));
|
newdict.replaceKey("/Subtype", QPDFObjectHandle::newName("/Form"));
|
||||||
|
@ -1062,8 +1062,7 @@ QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh)
|
||||||
}
|
}
|
||||||
std::string cm_str = std::string("q\n") + cm.unparse() + " cm\n";
|
std::string cm_str = std::string("q\n") + cm.unparse() + " cm\n";
|
||||||
this->oh.addPageContents(QPDFObjectHandle::newStream(&qpdf, cm_str), true);
|
this->oh.addPageContents(QPDFObjectHandle::newStream(&qpdf, cm_str), true);
|
||||||
this->oh.addPageContents(
|
this->oh.addPageContents(qpdf.newStream("\nQ\n"), false);
|
||||||
QPDFObjectHandle::newStream(&qpdf, "\nQ\n"), false);
|
|
||||||
this->oh.removeKey("/Rotate");
|
this->oh.removeKey("/Rotate");
|
||||||
QPDFObjectHandle rotate_obj = getAttribute("/Rotate", false);
|
QPDFObjectHandle rotate_obj = getAttribute("/Rotate", false);
|
||||||
if (!rotate_obj.isNull()) {
|
if (!rotate_obj.isNull()) {
|
||||||
|
|
|
@ -1696,7 +1696,7 @@ qpdf_oh
|
||||||
qpdf_oh_new_stream(qpdf_data qpdf)
|
qpdf_oh_new_stream(qpdf_data qpdf)
|
||||||
{
|
{
|
||||||
QTC::TC("qpdf", "qpdf-c called qpdf_oh_new_stream");
|
QTC::TC("qpdf", "qpdf-c called qpdf_oh_new_stream");
|
||||||
return new_object(qpdf, QPDFObjectHandle::newStream(qpdf->qpdf.get()));
|
return new_object(qpdf, qpdf->qpdf->newStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue
Block a user