vishnukottala / flexpaper

Automatically exported from code.google.com/p/flexpaper
0 stars 0 forks source link

FlexPaper (Flash Mode): Split Mode Does Not Work Anymore (former issue 321) #351

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Addition to issue 321 which has been deleted through the FlexPaper team 
although it is still active. 

### Background for this issue ###

We are using the following regular expressions for the different file types:

[docname].pdf_%.swf
[docname].pdf_%.swf.png
[docname].pdf_%.js

Based on the above file name system, FlexPaper counts all(!) files in order to 
evaluate the total number of pages. For instance, the result for the total 
number of pages of a document that has 28 pages would be:

28 (x swf-files) + 28 (x png-files) + 3 (x json-files) = 59 files = 58 pages 
although the document has only 28 pages.

### Solution for fixing this issue ###

In file "numpages.php" you should use identical(!) regular expressions for 
evaluating the number of files of a dedicated file type by adding the 
exentsion. So if you evaluate the total number of pages based on the number of 
"swf" files, add to line ...

$pagecount = count(glob($configManager->getConfig('path.swf') . $doc . "*"));

$pagecount = count(glob($configManager->getConfig('path.swf') . $doc . "*" . 
".swf"));

... in order to only count the .swf files.

One word with respect to removing issues through the FlexPaper team:
We have noticed that either forum posts did not get approved as well as issues 
are simply removed after a while. In our opinion, all these measures represent 
censorship which is unique in our experience.

According this, we expect that this issue report will be removed too.

Original issue reported on code.google.com by mentur...@gmail.com on 27 Jan 2013 at 12:20

GoogleCodeExporter commented 9 years ago
Thanks for clarifying this. I believe the former issue was deleted because it 
was thought to be invalid and we did not get a response when asking for a URL 
which demonstrated the behaviour. I didn't think the numpages.php was actually 
used any longer by our php scripts for counting pages but was rather a remnant 
from how it was done in previous versions. We will of course fix and update 
this script, thanks again

Original comment by erik.eng...@devaldi.com on 27 Jan 2013 at 4:39

GoogleCodeExporter commented 9 years ago
Just confirmed it - the numpages.php isn't used any longer so you just have an 
older version of our php scripts. If you update to the latest version of the 
php scripts we supply. We count pages using a different method since a few 
versions back:

var numPages            = <?php echo getTotalPages($pdfFilePath . $doc . ".pdf") ?>;

which traces to the function getTotalPages in common.php, which reads this from 
the actual PDF:
function getTotalPages($PDFPath) {
        $stream = @fopen($PDFPath, "r");
        $PDFContent = @fread ($stream, filesize($PDFPath));
        if(!$stream || !$PDFContent)
            return false;

        $firstValue = 0;
        $secondValue = 0;
        if(preg_match("/\/N\s+([0-9]+)/", $PDFContent, $matches)) {
            $firstValue = $matches[1];
        }

        if(preg_match_all("/\/Count\s+([0-9]+)/s", $PDFContent, $matches))
        {
            $secondValue = max($matches[1]);
        }
        return (($secondValue != 0) ? $secondValue : max($firstValue, $secondValue));
    }

Numpages.php will be removed to avoid any future confusion.

Original comment by erik.eng...@gmail.com on 27 Jan 2013 at 4:53

GoogleCodeExporter commented 9 years ago
Many thanks for the info and your support!

Original comment by mentur...@gmail.com on 28 Jan 2013 at 9:27