mirror of https://github.com/vitalif/phantomjs
OS X: Unsafe patch to fix selectable text on PDF output.
https://github.com/ariya/phantomjs/pull/11723 https://github.com/ariya/phantomjs/pull/115091.x
parent
244cf251cd
commit
42b3a86bcd
|
@ -0,0 +1,62 @@
|
|||
From 0663263bfa748b0933d7eff4b5e49d9ed97bcc84 Mon Sep 17 00:00:00 2001
|
||||
From: Illimar Tambek <illimar.tambek@gmail.com>
|
||||
Date: Thu, 31 Oct 2013 14:19:23 +0200
|
||||
Subject: [PATCH 1/2] Fix for PDF text not being selectable on Mac OSX.
|
||||
|
||||
Produces selectable text when printing/rasterizing to PDF on OSX.
|
||||
|
||||
https://github.com/ariya/phantomjs/issues/10373
|
||||
---
|
||||
src/webpage.cpp | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/src/webpage.cpp b/src/webpage.cpp
|
||||
index 89a34da..fae5855 100644
|
||||
--- a/src/webpage.cpp
|
||||
+++ b/src/webpage.cpp
|
||||
@@ -1067,6 +1067,14 @@ bool WebPage::renderPdf(const QString &fileName)
|
||||
QPrinter printer;
|
||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||
printer.setOutputFileName(fileName);
|
||||
+
|
||||
+ // Fix for PDF prints on Mac OSX. Produces selectable text
|
||||
+ #ifdef Q_WS_MACX
|
||||
+ if(fileName.endsWith(".pdf")) {
|
||||
+ printer.setOutputFormat(QPrinter::NativeFormat);
|
||||
+ }
|
||||
+ #endif
|
||||
+
|
||||
printer.setResolution(PHANTOMJS_PDF_DPI);
|
||||
QVariantMap paperSize = m_paperSize;
|
||||
|
||||
--
|
||||
1.8.5.1
|
||||
|
||||
|
||||
From 551caed5164ea0b5dcb1f1522c224186b982839b Mon Sep 17 00:00:00 2001
|
||||
From: Illimar Tambek <illimar.tambek@gmail.com>
|
||||
Date: Mon, 11 Nov 2013 10:03:15 +0200
|
||||
Subject: [PATCH 2/2] Remove file extension check
|
||||
|
||||
---
|
||||
src/webpage.cpp | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/webpage.cpp b/src/webpage.cpp
|
||||
index fae5855..1a15c13 100644
|
||||
--- a/src/webpage.cpp
|
||||
+++ b/src/webpage.cpp
|
||||
@@ -1070,9 +1070,7 @@ bool WebPage::renderPdf(const QString &fileName)
|
||||
|
||||
// Fix for PDF prints on Mac OSX. Produces selectable text
|
||||
#ifdef Q_WS_MACX
|
||||
- if(fileName.endsWith(".pdf")) {
|
||||
- printer.setOutputFormat(QPrinter::NativeFormat);
|
||||
- }
|
||||
+ printer.setOutputFormat(QPrinter::NativeFormat);
|
||||
#endif
|
||||
|
||||
printer.setResolution(PHANTOMJS_PDF_DPI);
|
||||
--
|
||||
1.8.5.1
|
||||
|
Loading…
Reference in New Issue