Forum Feature requests

PHP API support for --no-author-style and --no-default-style

dbarrett
The Prince.php API does not support the functionality of --no-author-style and --no-default-style. Attached is a diff against the current prince.php file (prince-php5-r7/prince.php) that adds these features. Could you please incorporate this into the official API? Thanks.
dbarrett
I can't attach .txt files, so here's the diff.

Index: prince.php
===================================================================
--- prince.php	(revision 12532)
+++ prince.php	(working copy)
@@ -3,6 +3,7 @@
 // Prince - PHP interface
 // Copyright 2005-2009 YesLogic Pty. Ltd.
 // http://www.princexml.com
+// Modified by Vistaprint 2010-03-04
 
 class Prince
 {
@@ -18,6 +19,8 @@
     private $compress;
     private $encrypt;
     private $encryptInfo;
+    private $noAuthorStyle;
+    private $noDefaultStyle;
 
     public function __construct($exePath)
     {
@@ -33,6 +36,8 @@
 	$this->compress = true;
 	$this->encrypt = false;
 	$this->encryptInfo = '';
+	$this->noAuthorStyle = false;
+	$this->noDefaultStyle = false;
     }
 
     // Add a CSS style sheet that will be applied to each document.
@@ -168,6 +173,14 @@
 	}
     }
 
+    public function setSuppressAuthorStyle($noAuthorStyle) {
+      $this->noAuthorStyle = $noAuthorStyle;
+    }
+
+    public function setSuppressDefaultStyle($noDefaultStyle) {
+      $this->noDefaultStyle = $noDefaultStyle;
+    }
+
     // Convert an XML or HTML file to a PDF file.
     // The name of the output PDF file will be the same as the name of the
     // input file but with an extension of ".pdf".
@@ -202,6 +215,7 @@
     public function convert_string_to_passthru($xmlString)
     {
 	$pathAndArgs = $this->getCommandLine();
+	error_log($pathAndArgs);
 	$pathAndArgs .= '--silent -';
 	    
         return $this->convert_internal_string_to_passthru($pathAndArgs, $xmlString);
@@ -287,6 +301,16 @@
 	    $cmdline .= '--encrypt ' . $this->encryptInfo;
 	}
 
+	if ($this->noAuthorStyle)
+	{
+	    $cmdline .= '--no-author-style ';
+	}
+
+	if ($this->noDefaultStyle)
+	{
+	    $cmdline .= '--no-default-style ';
+	}
+
 	return $cmdline;
     }
mikeday
Thanks, we'll take a look at this.
mikeday
I forgot to update this thread, but Prince has supported these options in the PHP wrapper for some time now. :)