Merge pull request #465 from letsfindaway/feat-403-grid-in-pdf

Feature: Export background grid/color to PDF
preferencesAboutTextFull
kaamui 2 years ago committed by GitHub
commit 2522873bd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      resources/etc/OpenBoard.config
  2. 12
      src/adaptors/UBExportPDF.cpp
  3. 2
      src/core/UBSettings.cpp
  4. 2
      src/core/UBSettings.h

@ -124,6 +124,8 @@ RefreshRateInFramePerSecond=2
[PDF]
enableQualityLossToIncreaseZoomPerfs=true
ExportBackgroundGrid=false
ExportBackgroundColor=false
Margin=20
PageFormat=A4
Resolution=300

@ -106,7 +106,17 @@ bool UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
// set background to white, no crossing for PDF output
bool isDark = scene->isDarkBackground();
UBPageBackground pageBackground = scene->pageBackground();
scene->setBackground(false, UBPageBackground::plain);
bool exportDark = isDark && UBSettings::settings()->exportBackgroundColor->get().toBool();
if (UBSettings::settings()->exportBackgroundGrid->get().toBool())
{
scene->setBackground(exportDark, pageBackground);
}
else
{
scene->setBackground(exportDark, UBPageBackground::plain);
}
// pageSize is the output PDF page size; it is set to equal the scene's boundary size; if the contents
// of the scene overflow from the boundaries, they will be scaled down.

@ -409,6 +409,8 @@ void UBSettings::init()
pdfZoomBehavior = new UBSetting(this, "PDF", "ZoomBehavior", "4");
enableQualityLossToIncreaseZoomPerfs = new UBSetting(this, "PDF", "enableQualityLossToIncreaseZoomPerfs", true);
exportBackgroundGrid = new UBSetting(this, "PDF", "ExportBackgroundGrid", false);
exportBackgroundColor = new UBSetting(this, "PDF", "ExportBackgroundColor", false);
podcastFramesPerSecond = new UBSetting(this, "Podcast", "FramesPerSecond", 10);
podcastVideoSize = new UBSetting(this, "Podcast", "VideoSize", "Medium");

@ -361,6 +361,8 @@ class UBSettings : public QObject
UBSetting* pdfZoomBehavior;
UBSetting* enableQualityLossToIncreaseZoomPerfs;
UBSetting* exportBackgroundGrid;
UBSetting* exportBackgroundColor;
UBSetting* podcastFramesPerSecond;
UBSetting* podcastVideoSize;

Loading…
Cancel
Save