Combining Two PDF Files
-
wrote on 21 Aug 2018, 04:00 last edited by
Is there any way to combine two PDF file generated using QT?
-
@ManiRon How did you generate them?
-
wrote on 21 Aug 2018, 04:35 last edited by
using Qprinter
-
@ManiRon I don't think Qt provides anything for this.
But can't you generate one PDF instead of generating two and then merging? -
wrote on 21 Aug 2018, 10:27 last edited by
sorry. Ya but i am trying to add a header to the PDF using the HTML and then i want to print the text is there any way i can do this
-
wrote on 21 Aug 2018, 10:28 last edited by
My HTML Code :
<!DOCTYPE html>
<html>
<head>
<style>
.logo {
width: 150px;
height: 120px;}
.logoHeader {
height: 120px;
vertical-align: middle;
text-align: center;
}.floatLeft { float: left; }
.floatRight { float: right; }
</style>
</head>
<body><header>
<img class="logo floatLeft" src="Logo.png" alt="Logo" /><img class="logo floatRight" src="Data.gif" alt="Logo" /> <h1 class="logoHeader">REPORT</h1>
</header>
</body>
</html> -
wrote on 21 Aug 2018, 10:32 last edited by
This is my QT Code :
QFile styleFile( "widget.qss" );
styleFile.open( QFile::ReadOnly );
QString hex = QString::fromLatin1( styleFile.readAll() );
styleFile.close();
QTextDocument document;
QTextDocument document1;
QString data = ui->teData->toPlainText();
document.setHtml(hex.append(data));
QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPaperSize(QPrinter::A4);
printer.setOutputFileName("test.pdf");
QPainter painter;
painter.begin(&printer);
painter.setBrush(Qt::transparent);
painter.end(); -
wrote on 25 Jan 2021, 14:40 last edited by
Hi,
To add header and footer I use the C library of https://wkhtmltopdf.org/ -
wrote on 15 May 2024, 11:25 last edited byThis post is deleted!