Skip to content

Commit

Permalink
[TD]Fix transparent area in pdf (fix FreeCAD#18443) (FreeCAD#18507)
Browse files Browse the repository at this point in the history
* [TD]fix transparent areas in pdf (FreeCAD#18443)

* [TD]restore use of PDF/A-1b format

- was not working in older versions of QPdfWriter
  • Loading branch information
WandererFan authored Dec 16, 2024
1 parent e6e281e commit fa327ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Mod/TechDraw/Gui/PagePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,9 @@ void PagePrinter::printAllPdf(QPrinter* printer, App::Document* doc)
QString documentName = QString::fromUtf8(doc->getName());
QPdfWriter pdfWriter(outputFile);

// setPdfVersion sets the printed PDF Version to comply with PDF/A-1b, more details under:
// https://www.kdab.com/creating-pdfa-documents-qt/ but this is not working as of Qt 5.12
// printer->setPdfVersion(QPagedPaintDevice::PdfVersion_A1b);
// pdfWriter.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b);
// set the printed PDF Version to comply with PDF/A-1b, more details under:
// https://www.kdab.com/creating-pdfa-documents-qt/
pdfWriter.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b);

pdfWriter.setTitle(documentName);
pdfWriter.setResolution(printer->resolution());
Expand Down Expand Up @@ -350,6 +349,7 @@ void PagePrinter::printPdf(ViewProviderPage* vpPage, const std::string& file)
// set up the pdfwriter
QString outputFile = QString::fromStdString(filespec);
QPdfWriter pdfWriter(outputFile);
pdfWriter.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b);
QPageLayout pageLayout = pdfWriter.pageLayout();
auto marginsdb = pageLayout.margins(QPageLayout::Millimeter);
QString documentName = QString::fromUtf8(vpPage->getDrawPage()->getNameInDocument());
Expand Down
1 change: 1 addition & 0 deletions src/Mod/TechDraw/Gui/QGIViewBalloon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ void QGIViewBalloon::setPens(void)
{
balloonLines->setWidth(m_lineWidth);
balloonShape->setWidth(m_lineWidth);
balloonShape->setFillColor(PreferencesGui::pageQColor());
arrow->setWidth(m_lineWidth);
}

Expand Down

0 comments on commit fa327ec

Please sign in to comment.