Create PDF and Reader Open Parameters

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

By Jason - March 31, 2011

Hi Jerry,

I don't think it's a matter of appending anything to the url that's passed to the plugin. The parameters you're specifying I'm assuming would be used to manipulate the settings of the reader displaying the pdf, it doesn't change the format of the pdf itself. That being said, we would probably be at the mercy of which ever browser and whichever version of the reader is being run at that particular time. For example, for this url:
http://50.6.159.105/about.php?pdf=1&1#toolbar=1&navpanes=1&scrollbar=1&zoom=100,

I looked at this in firefox and it seemed to work. The zoom was set to 100% at there was a toolbar at the top. However, when I look at the same link in Chrome, there is no toolbar indicating what the zoom level is, but there are links to the side to control zooming in and out. This can only be due to different browsers/readers.

Like I said the "Convert to PDF" link you currently have seems to be working, but I don't know if you'll be able to control those setting consistently.

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 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/