Without patch:
During configure "-- Qt6 found".
During build:
[ 92% 125/135] /usr/bin/c++ -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DXPDFWIDGET_PRINTING=1 -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04 -I/tmp/work/usr/ports/graphics/xpdf/work/.build -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/goo -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/fofi -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/splash -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf -isystem /usr/local/include/qt6/QtWidgets -isystem /usr/local/include/qt6 -isystem /usr/local/include/qt6/QtCore -isystem /usr/local/include/qt6/QtGui -isystem "/usr/local/include/qt6/QtDBus /usr/local/include/qt6/QtNetwork" -isystem "/usr/local/include/qt6/QtCore /usr/local/include/qt6/QtPrintSupport" -isystem /usr/local/include/qt6/QtDBus -isystem /usr/local/lib/qt6/mkspecs/freebsd-clang -isystem /usr/local/include/qt6/QtNetwork -isystem /usr/local/include/qt6/QtPrintSupport -O2 -pipe -march=core2 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -O2 -pipe -march=core2 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -DNDEBUG -std=gnu++17 -DQT_DBUS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_PRINTSUPPORT_LIB -fPIC -pthread -MD -MT xpdf-qt/CMakeFiles/xpdf.dir/XpdfWidgetPrint.cc.o -MF xpdf-qt/CMakeFiles/xpdf.dir/XpdfWidgetPrint.cc.o.d -o xpdf-qt/CMakeFiles/xpdf.dir/XpdfWidgetPrint.cc.o -c /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc FAILED: xpdf-qt/CMakeFiles/xpdf.dir/XpdfWidgetPrint.cc.o /usr/bin/c++ -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DXPDFWIDGET_PRINTING=1 -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04 -I/tmp/work/usr/ports/graphics/xpdf/work/.build -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/goo -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/fofi -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/splash -I/tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf -isystem /usr/local/include/qt6/QtWidgets -isystem /usr/local/include/qt6 -isystem /usr/local/include/qt6/QtCore -isystem /usr/local/include/qt6/QtGui -isystem "/usr/local/include/qt6/QtDBus /usr/local/include/qt6/QtNetwork" -isystem "/usr/local/include/qt6/QtCore /usr/local/include/qt6/QtPrintSupport" -isystem /usr/local/include/qt6/QtDBus -isystem /usr/local/lib/qt6/mkspecs/freebsd-clang -isystem /usr/local/include/qt6/QtNetwork -isystem /usr/local/include/qt6/QtPrintSupport -O2 -pipe -march=core2 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -O2 -pipe -march=core2 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -DNDEBUG -std=gnu++17 -DQT_DBUS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_PRINTSUPPORT_LIB -fPIC -pthread -MD -MT xpdf-qt/CMakeFiles/xpdf.dir/XpdfWidgetPrint.cc.o -MF xpdf-qt/CMakeFiles/xpdf.dir/XpdfWidgetPrint.cc.o.d -o xpdf-qt/CMakeFiles/xpdf.dir/XpdfWidgetPrint.cc.o -c /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc:328:3: error: no type named 'PaperSize' in 'QPrinter'; did you mean 'QPageSize'? QPrinter::PaperSize paperSize; ^~~~~~~~~~~~~~~~~~~ QPageSize /usr/local/include/qt6/QtPrintSupport/qprinter.h:25:7: note: 'QPageSize' declared here class QPageSize; ^ /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc:359:20: error: no member named 'paperSize' in 'QPrinter' paperSize = prt->paperSize(); ~~~ ^ /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc:360:23: error: no member named 'paperSize' in 'QPrinter' paperSizePts = prt->paperSize(QPrinter::Point); ~~~ ^ /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc:428:10: error: no member named 'A4' in 'QPrinter'; did you mean 'QPageSize::A4'? case QPrinter::A4: paperSizeStr = "A4"; break; ^~~~~~~~~~~~ QPageSize::A4 /usr/local/include/qt6/QtGui/qpagesize.h:34:9: note: 'QPageSize::A4' declared here A4, ^ /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc:429:10: error: no member named 'Comm10E' in 'QPrinter'; did you mean 'QPageSize::Comm10E'? case QPrinter::Comm10E: paperSizeStr = "COM10"; break; ^~~~~~~~~~~~~~~~~ QPageSize::Comm10E /usr/local/include/qt6/QtGui/qpagesize.h:53:9: note: 'QPageSize::Comm10E' declared here Comm10E, ^ /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc:430:10: error: no member named 'DLE' in 'QPrinter'; did you mean 'QPageSize::DLE'? case QPrinter::DLE: paperSizeStr = "DL"; break; ^~~~~~~~~~~~~ QPageSize::DLE /usr/local/include/qt6/QtGui/qpagesize.h:54:9: note: 'QPageSize::DLE' declared here DLE, ^ /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc:431:10: error: no member named 'Legal' in 'QPrinter'; did you mean 'QPageSize::Legal'? case QPrinter::Legal: paperSizeStr = "Legal"; break; ^~~~~~~~~~~~~~~ QPageSize::Legal /usr/local/include/qt6/QtGui/qpagesize.h:28:9: note: 'QPageSize::Legal' declared here Legal, ^ /tmp/work/usr/ports/graphics/xpdf/work/xpdf-4.04/xpdf-qt/XpdfWidgetPrint.cc:432:10: error: no member named 'Letter' in 'QPrinter'; did you mean 'QPageSize::Letter'? case QPrinter::Letter: paperSizeStr = "Letter"; break; ^~~~~~~~~~~~~~~~ QPageSize::Letter /usr/local/include/qt6/QtGui/qpagesize.h:27:9: note: 'QPageSize::Letter' declared here Letter, ^ 8 errors generated. ninja: build stopped: subcommand failed. *** Error code 1 Stop. make[1]: stopped in /usr/ports/graphics/xpdf *** Error code 1 Stop. make: stopped in /usr/ports/graphics/xpdf