From e4ad5ed5839d5f78b76128814a3cf966122b0d71 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Mon, 19 Oct 2015 14:04:21 +0200 Subject: Writer image export: cmd. line, default to white background This commit fixes the writer image export (jpeg, png) that didn't work because the export pixel size was set to 0 by default. Now the default is set to document size (which depends on system DPI). When exporting to a PNG the background was transparent, which may not be desired. The background color is now by default white and can be changed for DocumentToGraphicRenderer, but the dialog or command line don't support such an option - for now. Change-Id: I16ffd3cd60c47b52768f43ae4c4c170fc821033b --- svtools/source/filter/DocumentToGraphicRenderer.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'svtools') diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx index d410f4c7db34..e33a94ec416e 100644 --- a/svtools/source/filter/DocumentToGraphicRenderer.cxx +++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx @@ -94,7 +94,8 @@ Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 aCurrentPage) Graphic DocumentToGraphicRenderer::renderToGraphic( sal_Int32 aCurrentPage, Size aDocumentSizePixel, - Size aTargetSizePixel) + Size aTargetSizePixel, + Color aPageColor) { if (!mxModel.is() || !mxController.is() || !mxRenderable.is()) @@ -127,6 +128,12 @@ Graphic DocumentToGraphicRenderer::renderToGraphic( aMtf.Record( pOutputDev ); + if (aPageColor != Color(COL_TRANSPARENT)) + { + pOutputDev->SetBackground(Wallpaper(aPageColor)); + pOutputDev->Erase(); + } + uno::Any aSelection; aSelection <<= mxDocument; mxRenderable->render(aCurrentPage - 1, aSelection, renderProps ); -- cgit