Merged in bugfix/HOR-3620 (pull request #5852)

HOR-3620

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
David Callizaya
2017-08-04 19:58:50 +00:00
committed by Paula Quispe
8 changed files with 0 additions and 543 deletions

View File

@@ -1 +0,0 @@
This folder should be writable.

View File

@@ -1,160 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set("display_errors","1");
@set_time_limit(600);
$urls = array(
'http://247realmedia.com',
'http://888.com',
'http://abetterinternet.com',
'http://adsense.google.com',
'http://alphadg.com',
'http://allwomencentral.com/?r=sub',
'http://aol.com',
'http://www.articlehub.com/add.html',
'http://aur.archlinux.org',
'http://bbc.co.uk',
'http://benews.net',
'http://casalemedia.com',
'http://cnn.com',
'http://www.codeguru.com/register.php',
'http://cra-arc.gc.ca/menu-e.html',
'http://crux.nu',
'http://cs.wisc.edu/~ghost/',
'http://distrowatch.com',
'http://dmoz.org/cgi-bin/apply.cgi?submit=Proceed&where=Business%2FEmployment%2FCareers&id=&lk=&loc=', // Connect
'http://download.com',
'http://ebay.com',
'http://ewizard.com',
'http://exactsearch.net',
'http://exitexchange.com',
'http://ezinearticles.com/submit',
'http://falkag.net',
'http://fedora.redhat.com',
'http://freebsd.org',
'http://freewho.com/expired/index.php',
'http://gentoo.org',
'http://geocities.com',
'http://www.getafreelancer.com/users/signup.php',
'http://gmail.com',
'http://go.com',
'http://google.co.in',
'http://google.com/about.html',
'http://google.com/froogle',
'http://google.com/services/',
'http://google.fi/fi',
'http://guru.com/pro/post_profile.cfm',
'http://hamster.sazco.net',
'http://www-128.ibm.com/developerworks/linux/library/l-proc.html',
'http://hotmail.com',
'http://indianrail.gov.in',
'http://internet-optimizer.com',
'http://jakpsatweb.cz/css/css-vertical-center-solution.html',
'http://jobsearch.monsterindia.com/advanced_job_search.html',
'http://johnlewis.com',
'http://kubuntu.org',
'http://lyrc.com.ar/en/add/add.php',
'http://microsoft.com',
'http://msn.com',
'http://myblog.de',
'http://myway.com',
'http://mywebsearch.com',
'http://net-offers.net',
'http://netscape.com',
'http://netvenda.com',
'http://offeroptimizer.com',
'http://onet.pl',
'http://opensuse.org',
'http://osnews.com',
'http://papajohns.com',
'http://partypoker.com',
'http://passport.com',
'http://php.net',
'http://pilger.carlton.com',
'http://priyank.one09.net',
'http://python.org/~guido/',
'http://realmedia.com',
'http://rentacoder.com',
'http://revenue.net',
'http://rubixlinux.org',
'http://sage.com/local/regionNorthAmerica.aspx',
'http://searchscout.com',
'http://search.ebay.in/ws/search/AdvSearch?sofindtype=13',
'http://services.princetonreview.com/register.asp?RUN=%2FstudentTools%2FstudentTool%2Easp&RCN=auth&RDN=1&ALD=http%3A%2F%2Ftestprep%2Eprincetonreview%2Ecom',
'http://smarty.php.net',
'http://stallman.org',
'http://stanton-finley.net/fedora_core_5_installation_notes.html',
'http://thefacebook.com',
'http://tickle.com',
'http://trafficmp.com',
'http://tufat.com',
'http://ubuntu.com',
'http://user.it.uu.se/~jan/html2ps.html',
'http://vianet.com.pl',
'http://website.in/domain.php',
'http://whenu.com',
'http://whitehouse.gov',
'http://whois.org/',
'http://en.wikipedia.org',
'http://en.wikipedia.org/w/index.php?title=Spangenhelm&action=edit',
'http://wolfram.com',
'http://www.xe.com/ucc',
'http://yahoo.com',
'http://yahoomail.com',
'http://edit.yahoo.com/config/eval_register',
'http://zango.com'
);
require_once('../pipeline.class.php');
parse_config_file('../html2ps.config');
$g_config = array(
'cssmedia' => 'screen',
'renderimages' => true,
'renderforms' => true,
'renderlinks' => true,
'mode' => 'html',
'debugbox' => false,
'draw_page_border' => false
);
$media = Media::predefined('A4');
$media->set_landscape(false);
$media->set_margins(array('left' => 10,
'right' => 10,
'top' => 10,
'bottom' => 10));
$media->set_pixels(1024);
$g_px_scale = mm2pt($media->width() - $media->margins['left'] - $media->margins['right']) / $media->pixels;
$g_pt_scale = $g_px_scale * 1.43;
$pipeline = new Pipeline;
$pipeline->configure($g_config);
$pipeline->fetchers[] = new FetcherURL;
$pipeline->data_filters[] = new DataFilterDoctype();
$pipeline->data_filters[] = new DataFilterUTF8("");
$pipeline->data_filters[] = new DataFilterHTML2XHTML;
$pipeline->parser = new ParserXHTML;
$pipeline->pre_tree_filters = array();
$pipeline->layout_engine = new LayoutEngineDefault;
$pipeline->post_tree_filters = array();
$pipeline->output_driver = new OutputDriverFPDF();
$time = time();
foreach ($urls as $url) {
$pipeline->destination = new DestinationFile($url);
$pipeline->process($url, $media);
$message = sprintf("<br/>Processing of '%s' completed in %u seconds", $url, time() - $time);
error_log($message);
print($message."<br/>");
flush();
$time = time();
};
?>

View File

@@ -1,8 +0,0 @@
<?php
ob_start();
var_dump($_POST);
error_log(ob_get_contents());
ob_end_clean();
?>

View File

@@ -1,38 +0,0 @@
<?php
require_once('../pipeline.class.php');
parse_config_file('../html2ps.config');
$g_config = array(
'cssmedia' => 'screen',
'renderimages' => true,
'renderforms' => false,
'renderlinks' => true,
'mode' => 'html',
'debugbox' => false,
'draw_page_border' => false
);
$media = Media::predefined('A4');
$media->set_landscape(false);
$media->set_margins(array('left' => 0,
'right' => 0,
'top' => 0,
'bottom' => 0));
$media->set_pixels(1024);
$g_px_scale = mm2pt($media->width() - $media->margins['left'] - $media->margins['right']) / $media->pixels;
$g_pt_scale = $g_px_scale * 1.43;
$pipeline = new Pipeline;
$pipeline->configure($g_config);
$pipeline->fetchers[] = new FetcherURL;
$pipeline->data_filters[] = new DataFilterHTML2XHTML;
$pipeline->parser = new ParserXHTML;
$pipeline->layout_engine = new LayoutEngineDefault;
$pipeline->output_driver = new OutputDriverFPDF($media);
$pipeline->destination = new DestinationFile(null);
$pipeline->process('http://localhost:81/testing/ww.html', $media);
?>

View File

@@ -1,35 +0,0 @@
<?php
require_once('../pipeline.factory.class.php');
parse_config_file('../html2ps.config');
global $g_config;
$g_config = array(
'cssmedia' => 'screen',
'renderimages' => true,
'renderforms' => false,
'renderlinks' => true,
'mode' => 'html',
'debugbox' => false,
'draw_page_border' => false
);
$media = Media::predefined('A4');
$media->set_landscape(false);
$media->set_margins(array('left' => 0,
'right' => 0,
'top' => 0,
'bottom' => 0));
$media->set_pixels(1024);
global $g_px_scale;
$g_px_scale = mm2pt($media->width() - $media->margins['left'] - $media->margins['right']) / $media->pixels;
global $g_pt_scale;
$g_pt_scale = $g_px_scale * 1.43;
$pipeline = PipelineFactory::create_default_pipeline("","");
$pipeline->configure($g_config);
$pipeline->process('http://localhost:81/testing/ww.html', $media);
?>

View File

@@ -1,94 +0,0 @@
<?php
require_once('../config.inc.php');
require_once(HTML2PS_DIR.'pipeline.factory.class.php');
@set_time_limit(10000);
parse_config_file(HTML2PS_DIR.'html2ps.config');
/**
* Handles the saving generated PDF to user-defined output file on server
*/
class MyDestinationFile extends Destination {
/**
* @var String result file name / path
* @access private
*/
var $_dest_filename;
function MyDestinationFile($dest_filename) {
$this->_dest_filename = $dest_filename;
}
function process($tmp_filename, $content_type) {
copy($tmp_filename, $this->_dest_filename);
}
}
class MyFetcherLocalFile extends Fetcher {
var $_content;
function MyFetcherLocalFile($file) {
$this->_content = file_get_contents($file);
}
function get_data($dummy1) {
return new FetchedDataURL($this->_content, array(), "");
}
function get_base_url() {
return "";
}
}
/**
* Runs the HTML->PDF conversion with default settings
*
* Warning: if you have any files (like CSS stylesheets and/or images referenced by this file,
* use absolute links (like http://my.host/image.gif).
*
* @param $path_to_html String path to source html file.
* @param $path_to_pdf String path to file to save generated PDF to.
*/
function convert_to_pdf($path_to_html, $path_to_pdf) {
$pipeline = PipelineFactory::create_default_pipeline("", // Attempt to auto-detect encoding
"");
// Override HTML source
$pipeline->fetchers[] = new MyFetcherLocalFile($path_to_html);
$filter = new PreTreeFilterHeaderFooter("HEADER", "FOOTER");
$pipeline->pre_tree_filters[] = $filter;
// Override destination to local file
$pipeline->destination = new MyDestinationFile($path_to_pdf);
$baseurl = "";
$media = Media::predefined("A4");
$media->set_landscape(false);
$media->set_margins(array('left' => 0,
'right' => 0,
'top' => 10,
'bottom' => 10));
$media->set_pixels(1024);
global $g_config;
$g_config = array(
'cssmedia' => 'screen',
'scalepoints' => '1',
'renderimages' => true,
'renderlinks' => true,
'renderfields' => true,
'renderforms' => false,
'mode' => 'html',
'encoding' => '',
'debugbox' => false,
'pdfversion' => '1.4',
'draw_page_border' => false
);
$pipeline->configure($g_config);
$pipeline->process($baseurl, $media);
}
convert_to_pdf("../testsuite/encoding/iso-8859-2.html", "../data/testing/test.pdf");
?>

View File

@@ -1,112 +0,0 @@
<?php
/**
* Thanks for JensE for providing the code of fetcher class
*/
require_once('../config.inc.php');
require_once(HTML2PS_DIR.'pipeline.factory.class.php');
@set_time_limit(10000);
parse_config_file(HTML2PS_DIR.'html2ps.config');
/**
* Handles the saving generated PDF to user-defined output file on server
*/
class MyDestinationFile extends Destination {
/**
* @var String result file name / path
* @access private
*/
var $_dest_filename;
function MyDestinationFile($dest_filename) {
$this->_dest_filename = $dest_filename;
}
function process($tmp_filename, $content_type) {
copy($tmp_filename, $this->_dest_filename);
}
}
class MyFetcherMemory extends Fetcher {
var $base_path;
var $content;
function MyFetcherMemory($content, $base_path) {
$this->content = $content;
$this->base_path = $base_path;
}
function get_data($url) {
if (!$url) {
return new FetchedDataURL($this->content, array(), "");
} else {
// remove the "file:///" protocol
if (substr($url,0,8)=='file:///') {
$url=substr($url,8);
// remove the additional '/' that is currently inserted by utils_url.php
if (PHP_OS == "WINNT") $url=substr($url,1);
}
return new FetchedDataURL(@file_get_contents($url), array(), "");
}
}
function get_base_url() {
return 'file:///'.$this->base_path.'/dummy.html';
}
}
/**
* Runs the HTML->PDF conversion with default settings
*
* Warning: if you have any files (like CSS stylesheets and/or images referenced by this file,
* use absolute links (like http://my.host/image.gif).
*
* @param $path_to_html String HTML code to be converted
* @param $path_to_pdf String path to file to save generated PDF to.
* @param $base_path String base path to use when resolving relative links in HTML code.
*/
function convert_to_pdf($html, $path_to_pdf, $base_path="") {
$pipeline = PipelineFactory::create_default_pipeline("", // Attempt to auto-detect encoding
"");
// Override HTML source
// @TODO: default http fetcher will return null on incorrect images
// Bug submitted by 'imatronix' (tufat.com forum).
$pipeline->fetchers[] = new MyFetcherMemory($html, $base_path);
// Override destination to local file
$pipeline->destination = new MyDestinationFile($path_to_pdf);
$baseurl = "";
$media = Media::predefined("A4");
$media->set_landscape(false);
$media->set_margins(array('left' => 0,
'right' => 0,
'top' => 0,
'bottom' => 0));
$media->set_pixels(1024);
global $g_config;
$g_config = array(
'cssmedia' => 'screen',
'scalepoints' => '1',
'renderimages' => true,
'renderlinks' => true,
'renderfields' => true,
'renderforms' => false,
'mode' => 'html',
'encoding' => '',
'debugbox' => false,
'pdfversion' => '1.4',
'draw_page_border' => false
);
$pipeline->configure($g_config);
$pipeline->process($baseurl, $media);
}
convert_to_pdf(file_get_contents("../testsuite/encoding/iso-8859-2.html"), "../data/testing/test.pdf");
?>

View File

@@ -1,95 +0,0 @@
<?php
require_once('../pipeline.class.php');
require_once('../pipeline.factory.class.php');
parse_config_file('../html2ps.config');
/**
* Runs the HTML->PDF conversion with default settings
*
* Warning: if you have any files (like CSS stylesheets and/or images referenced by this file,
* use absolute links (like http://my.host/image.gif).
*
* @param $path_to_html String path to source html file.
* @param $path_to_pdf String path to file to save generated PDF to.
*/
function convert_to_pdf($path_to_html, $path_to_pdf) {
/**
* Handles the saving generated PDF to user-defined output file on server
*/
class MyDestinationFile extends Destination {
/**
* @var String result file name / path
* @access private
*/
var $_dest_filename;
function MyDestinationFile($dest_filename) {
$this->_dest_filename = $dest_filename;
}
function process($tmp_filename, $content_type) {
copy($tmp_filename, $this->_dest_filename);
}
}
class MyFetcherLocalFile extends Fetcher {
var $_content;
function MyFetcherLocalFile($file) {
$this->_content = file_get_contents($file);
}
function get_data($dummy1) {
return new FetchedDataURL($this->_content, array(), "");
}
function get_base_url() {
return "";
}
}
$pipeline = PipelineFactory::create_default_pipeline("", // Attempt to auto-detect encoding
"");
// Override HTML source
$pipeline->fetchers[] = new MyFetcherLocalFile($path_to_html);
// Override destination to local file
$pipeline->destination = new MyDestinationFile($path_to_pdf);
$baseurl = "";
$media = Media::predefined("A4");
$media->set_landscape(false);
$media->set_margins(array('left' => 0,
'right' => 0,
'top' => 0,
'bottom' => 0));
$media->set_pixels(1024);
global $g_config;
$g_config = array(
'cssmedia' => 'screen',
'renderimages' => true,
'renderlinks' => true,
'renderfields' => true,
'renderforms' => false,
'mode' => 'html',
'encoding' => '',
'debugbox' => false,
'pdfversion' => '1.4',
'draw_page_border' => false
);
global $g_px_scale;
$g_px_scale = mm2pt($media->width() - $media->margins['left'] - $media->margins['right']) / $media->pixels;
global $g_pt_scale;
$g_pt_scale = $g_px_scale * 1.43;
$pipeline->process($baseurl, $media);
}
convert_to_pdf("./testing/forms.html", "./testing/forms.pdf");
?>