Set page boxes

This commit is contained in:
Jakub Melka
2020-11-10 19:31:33 +01:00
parent 8167065be5
commit 1382ead109
6 changed files with 484 additions and 27 deletions

View File

@ -301,3 +301,24 @@ void PDFExamplesGenerator::generateAnnotationsExample()
pdf::PDFDocumentWriter writer(nullptr);
writer.write("Ex_Annotations.pdf", &document, false);
}
void PDFExamplesGenerator::generatePageBoxesExample()
{
pdf::PDFDocumentBuilder builder;
builder.setDocumentTitle("Test document - Page Boxes");
builder.setDocumentAuthor("Jakub Melka");
builder.setDocumentCreator(QCoreApplication::applicationName());
builder.setDocumentSubject("Testing page boxes");
builder.setLanguage(QLocale::system());
pdf::PDFObjectReference pageReference = builder.appendPage(QRectF(0, 0, 200, 200));
builder.setPageMediaBox(pageReference, QRectF(0, 0, 400, 400));
builder.setPageCropBox(pageReference, QRectF(10, 10, 380, 380));
builder.setPageBleedBox(pageReference, QRectF(20, 20, 360, 360));
builder.setPageTrimBox(pageReference, QRectF(30, 30, 340, 340));
// Write result to a file
pdf::PDFDocument document = builder.build();
pdf::PDFDocumentWriter writer(nullptr);
writer.write("Ex_PageBoxes.pdf", &document, false);
}