Create PDF and Reader Open Parameters

14 posts by 4 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: April 4, 2011   (RSS)

Re: [Jason] Create PDF and Reader Open Parameters

By gkornbluth - April 1, 2011

Good morning Jason,

I agree, and I’m using the same FF browser for all my testing.

I’m sorry if it seems that I’m beating on this to excess, but let me back track a bit...

I’d like to be able to pass open parameters to the PDF reader using the url_as_inline_pdf code, as I'm able to using the output_as_inline_pdf.

The basic issues are that:

_____________________________________________________

I can always get the added open parameters to work for the the output_as_inline_pdf code.

In the head of my viewer:

<?php if (@$_REQUEST['pdf']) { createPDF_fromOutput('inline', 'example.pdf'); } ?>

In the body of my viewer:

<?php if (@$_REQUEST['pdf']): ?>&nbsp;<?php else: ?><a href="http://my_site.com/about.php? pdf=1&<?php echo $my_tableRecord['num'] ?>#toolbar=1&navpanes=1&scrollbar=1&zoom=100">CLICK TO CONVERT THIS PAGE TO A PDF</a><?php endif ?>

Example: http://50.6.159.105/about.php

____________________________________________________

But I can’t seem to get the parameters to work at all with the url_as_inline_pdf code.

Original code:

<?php
$url = "http://www.my_site.com/about3.php";
$data = createPDF_fromUrl($url);
createPDF_display('inline', $data, 'example.pdf');
?>


As modified per your suggestion: (pdf_parameters value: #zoom=185)

<?php
$url = "http://www.elleschorrphotography.com/exhibitions3.php";
$addon = $common_informationRecord['pdf_parameters'] ;
$data = createPDF_fromUrl($url);
createPDF_display('inline',$data, 'example.pdf'.$addon);
?>


Example: http://www.elleschorrphotography.com/exhibitions4.php
_____________________________________________________
_____________________________________________________

I’ve also tried using a command line switch with this code to no avail.

<?php
$GLOBALS['CREATEPDF_CUSTOM_SWITCHES'] = '--zoom 50';
$url = "http://www.elleschorrphotography.com/exhibitions3.php";
$data = createPDF_fromUrl($url);
createPDF_display('inline', $data, 'example.pdf');
?>


Example: http://www.elleschorrphotography.com/exhibitions7.php

I can only assume that my zoom syntax is wrong, because if I substitute –toc for --zoom 50 a table of contents is generated.

Example: http://www.elleschorrphotography.com/exhibitions8.php

The wkhtmltopdf help docs specify the format to be: --zoom <float> Use this zoom factor (default 1)

No matter what syntax I’ve tried, --zoom 50%, [--zoom 50], and both with commas after ‘zoom, I get errors.

Wow, am I lost.

Thanks for your continued help.

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Jason - April 4, 2011

Hi Jerry,

From the looks of it, these url parameters work inconsistently. Also, they only seem to work on the actual pdf reader. This means that we wouldn't want to put it in as part of the actual creation of the pdf.

You could try something like this:

$url = "http://www.elleschorrphotography.com/exhibitions3.php".$common_informationRecord['pdf_parameters'] ;
$data = createPDF_fromUrl($url);
createPDF_display('inline',$data, 'example.pdf');


Otherwise, I'd just apply the parameters to the link that a user clicks on to view the pdf

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Create PDF and Reader Open Parameters

By gkornbluth - April 4, 2011

Jason,

Thanks very much for all your help.

That didn't work, and now that I've upgraded to FF 4, there are a whole new set of inconsistency issues.

I think that I'll have to move on and not pursue this for now.

If anything comes to mind, I'm willing to try it.

Again.

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php