mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
DocPage Organizer: Assemble documents
This commit is contained in:
@@ -29,6 +29,10 @@ PDFOperationResult PDFDocumentManipulator::assemble(const AssembledPages& pages)
|
||||
return tr("Empty page list.");
|
||||
}
|
||||
|
||||
m_flags = None;
|
||||
m_mergedObjects = { };
|
||||
m_assembledDocument = PDFDocument();
|
||||
|
||||
try
|
||||
{
|
||||
classify(pages);
|
||||
|
@@ -207,6 +207,23 @@ PDFObject PDFPage::getOutputIntents(const PDFObjectStorage* storage) const
|
||||
return getObjectFromPageDictionary(storage, "OutputIntents");
|
||||
}
|
||||
|
||||
QSizeF PDFPage::getRotatedSize(const QSizeF& size, PageRotation rotation)
|
||||
{
|
||||
switch (rotation)
|
||||
{
|
||||
case PageRotation::None:
|
||||
case PageRotation::Rotate180:
|
||||
// Preserve rotation
|
||||
break;
|
||||
|
||||
case PageRotation::Rotate90:
|
||||
case PageRotation::Rotate270:
|
||||
return size.transposed();
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
QRectF PDFPage::getRotatedBox(const QRectF& rect, PageRotation rotation)
|
||||
{
|
||||
switch (rotation)
|
||||
|
@@ -84,6 +84,34 @@ constexpr PageRotation getPageRotationRotatedLeft(PageRotation rotation)
|
||||
return PageRotation::None;
|
||||
}
|
||||
|
||||
constexpr PageRotation getPageRotationCombined(PageRotation r1, PageRotation r2)
|
||||
{
|
||||
while (r1 != PageRotation::None)
|
||||
{
|
||||
r2 = getPageRotationRotatedRight(r2);
|
||||
r1 = getPageRotationRotatedLeft(r1);
|
||||
}
|
||||
|
||||
return r2;
|
||||
}
|
||||
|
||||
constexpr PageRotation getPageRotationInversed(PageRotation rotation)
|
||||
{
|
||||
switch (rotation)
|
||||
{
|
||||
case PageRotation::None:
|
||||
return PageRotation::None;
|
||||
case PageRotation::Rotate90:
|
||||
return PageRotation::Rotate270;
|
||||
case PageRotation::Rotate180:
|
||||
return PageRotation::Rotate180;
|
||||
case PageRotation::Rotate270:
|
||||
return PageRotation::Rotate90;
|
||||
}
|
||||
|
||||
return PageRotation::None;
|
||||
}
|
||||
|
||||
/// This class represents attributes, which are inheritable. Also allows merging from
|
||||
/// parents.
|
||||
class PDFPageInheritableAttributes
|
||||
@@ -241,6 +269,7 @@ public:
|
||||
/// of 1 / 72 inch. Default value is 1.0.
|
||||
inline PDFReal getUserUnit() const { return m_userUnit; }
|
||||
|
||||
static QSizeF getRotatedSize(const QSizeF& size, PageRotation rotation);
|
||||
static QRectF getRotatedBox(const QRectF& rect, PageRotation rotation);
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user