diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2014-01-28 06:06:09 +1030 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2014-02-05 19:42:50 +1030 |
commit | 4cda839cb489fe5cd4726109cb9ab8b0ba2fa563 (patch) | |
tree | 0fda5266a15ecfa842025788741e16c792acb7b2 | |
parent | 45a87afdf1372911aa1ba840557e61627cdc7b4f (diff) |
pdftops: ensure there is always a page size in the output
even if the PDF file as badly broken.
-rw-r--r-- | poppler/PSOutputDev.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 34b7cbd9..a85fc24c 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -1257,6 +1257,13 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, if (!paperMatch) { w = paperWidth; h = paperHeight; + if (w < 0 || h < 0) { + // Unable to obtain a paper size from the document and no page size + // specified. In this case use A4 as the page size to ensure the PS output is + // valid. This will only occur if the PDF is very broken. + w = 595; + h = 842; + } } else if (noCropA) { w = (int)ceil(page->getMediaWidth()); h = (int)ceil(page->getMediaHeight()); |