Redact bugfixing

This commit is contained in:
Jakub Melka
2020-12-30 15:45:24 +01:00
parent 59721d7de8
commit 6f0b72ba3b
8 changed files with 161 additions and 5 deletions

View File

@ -462,6 +462,30 @@ PDFObjectFactory& PDFObjectFactory::operator<<(TextAnnotationIcon icon)
return *this;
}
PDFObjectFactory& PDFObjectFactory::operator<<(PageRotation pageRotation)
{
switch (pageRotation)
{
case pdf::PageRotation::None:
*this << PDFInteger(0);
break;
case pdf::PageRotation::Rotate90:
*this << PDFInteger(90);
break;
case pdf::PageRotation::Rotate180:
*this << PDFInteger(180);
break;
case pdf::PageRotation::Rotate270:
*this << PDFInteger(270);
break;
default:
Q_ASSERT(false);
}
return *this;
}
PDFObjectFactory& PDFObjectFactory::operator<<(WrapEmptyArray)
{
beginArray();
@ -4788,6 +4812,20 @@ void PDFDocumentBuilder::setPageMediaBox(PDFObjectReference page,
}
void PDFDocumentBuilder::setPageRotation(PDFObjectReference page,
PageRotation rotation)
{
PDFObjectFactory objectBuilder;
objectBuilder.beginDictionary();
objectBuilder.beginDictionaryItem("Rotate");
objectBuilder << rotation;
objectBuilder.endDictionaryItem();
objectBuilder.endDictionary();
PDFObject updatedPageObject = objectBuilder.takeObject();
mergeTo(page, updatedPageObject);
}
void PDFDocumentBuilder::setPageTrimBox(PDFObjectReference page,
QRectF box)
{