mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Set page boxes
This commit is contained in:
@ -23,4 +23,5 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
PDFExamplesGenerator::generateAnnotationsExample();
|
||||
PDFExamplesGenerator::generatePageBoxesExample();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
explicit PDFExamplesGenerator() = delete;
|
||||
|
||||
static void generateAnnotationsExample();
|
||||
static void generatePageBoxesExample();
|
||||
};
|
||||
|
||||
#endif // PDFEXAMPLESGENERATOR_H
|
||||
|
Reference in New Issue
Block a user