Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Problems with multipage PDF Template

Received: by 10.52.240.229 with SMTP id wd5mr1935673vdc.8.1340382599079;
        Fri, 22 Jun 2012 09:29:59 -0700 (PDT)
X-BeenThere: prawn-ruby@googlegroups.com
Received: by 10.221.13.130 with SMTP id pm2ls870061vcb.6.gmail; Fri, 22 Jun
 2012 09:29:58 -0700 (PDT)
Received: by 10.52.94.147 with SMTP id dc19mr168932vdb.17.1340382598006;
        Fri, 22 Jun 2012 09:29:58 -0700 (PDT)
Date: Fri, 22 Jun 2012 09:29:57 -0700 (PDT)
From: 42GB <42g...@googlemail.com>
To: prawn-ruby@googlegroups.com
Message-Id: <71ad9374-5f48-4069-a4e6-e2507aa3f008@googlegroups.com>
In-Reply-To: <CAHPJKcvriEs5CX95VcqfJjOMf84U7SPXd+2vxLOQfkOiv5ZS_A@mail.gmail.com>
References: <64722265-5702-4c52-80aa-e83e14cdc4c8@googlegroups.com>
 <CAHPJKcvriEs5CX95VcqfJjOMf84U7SPXd+2vxLOQfkOiv5ZS_A@mail.gmail.com>
Subject: Re: Problems with multipage PDF Template
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_274_8166694.1340382597617"

------=_Part_274_8166694.1340382597617
Content-Type: multipart/alternative; 
	boundary="----=_Part_275_20008958.1340382597617"

------=_Part_275_20008958.1340382597617
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hi Aristata,
*
*
thanks for your response and your tip. For my understanding: This new 
defined method is automatically called, if the page breaks, right?
So i have to define that method in the context of Prawn::Document, so that 
the pdf = Prawn::Document.new() can access it. I don't get it. 
I have to try it out, at the moment it looks more like a ruby problem to 
me. I'll send updates. THX.

Cheers, Georg


Am Freitag, 22. Juni 2012 17:40:15 UTC+2 schrieb Aristata:
>
> Define a method start_new_page(options)
>
> def start_new_page(options={})
>   opts = options.reverse_merge!({
>     :template => path_to_template 
>   })
>  super(opts)
> end
>
> On Fri, Jun 22, 2012 at 8:17 AM, 42GB wrote:
>
>> Hi Group,
>>
>> I'm just working on a PDF-Generator. I want to use a fancy PDF as a 
>> template. The template has 2 pages. I'm trying to achieve to get the first 
>> page of the template on the first page of the new generated pdf and the 
>> second page of the template on all following pages of the new generated 
>> pdf. First step is no Problem. I'm generating a pdf with this:
>>
>> Prawn::Document.generate(filename, :page_size => "A4", 
>> :skip_page_creation => true) do |pdf|
>>
>> # Afterwards i set the template for the first site like this:
>>
>> pdf.start_new_page(:template => path_to_template, template_page => 1)
>>
>> Now i'm generating content. And this content is getting longer and 
>> longer... At some point a new page is automatically generated, but without 
>> any template. Because of not running the method #start_new_page on the 
>> second page, i have no template. Just a Guess!
>>
>> The Question is:  But how is it possible to define :template for 
>> following pages, which are not especially generated by the method 
>> #start_new_page? Did i miss something? I'm happy about every bit of 
>> information.
>>
>> Cheers, Georg 
>>
>
>
------=_Part_275_20008958.1340382597617
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

H<font color=3D"#000000">i&nbsp;<span style=3D"font-weight: bold; text-alig=
n: left; white-space: nowrap; ">Aristata,</span></font><div><div style=3D"t=
ext-align: left;"><font color=3D"#790619"><span style=3D"white-space: nowra=
p;"><b><br></b></span></font></div><div style=3D"text-align: left;"><font c=
olor=3D"#000000"><span style=3D"white-space: nowrap;">thanks for your respo=
nse and your tip. For my understanding: This new defined method is automati=
cally called, if the page breaks, right?</span></font></div><div style=3D"t=
ext-align: left;"><font color=3D"#000000"><span style=3D"white-space: nowra=
p;">So i have to define that method in the context of Prawn::Document, so t=
hat the pdf =3D Prawn::Document.new() can access it. I don't get it.&nbsp;<=
/span></font></div><div style=3D"text-align: left;"><font color=3D"#000000"=
><span style=3D"white-space: nowrap;">I have to try it out, at the moment i=
t looks more like a ruby problem to me. I'll send updates. THX.</span></fon=
t></div><div style=3D"text-align: left;"><font color=3D"#000000"><span styl=
e=3D"white-space: nowrap;"><br></span></font></div><div style=3D"text-align=
: left;"><font color=3D"#000000"><span style=3D"white-space: nowrap;">Cheer=
s, Georg</span></font></div><div style=3D"text-align: left;"><font color=3D=
"#000000"><span style=3D"white-space: nowrap;"><br></span></font></div><div=
 style=3D"text-align: left;"><font color=3D"#000000"><span style=3D"white-s=
pace: nowrap;"><br></span></font></div><div>Am Freitag, 22. Juni 2012 17:40=
:15 UTC+2 schrieb Aristata:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Def=
ine a method start_new_page(options)<div><br></div><div>def start_new_page(=
options=3D{})</div><div>&nbsp; opts =3D options.reverse_merge!({</div><div>=
&nbsp; &nbsp; :template =3D&gt; path_to_template&nbsp;</div><div>&nbsp; })<=
/div><div>&nbsp;super(opts)</div>
<div>end<br><br><div class=3D"gmail_quote">On Fri, Jun 22, 2012 at 8:17 AM,=
 42GB&nbsp;wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Group,<div><br></div><div>I'm just working on a PDF-Generator. I want to=
 use a fancy PDF as a template. The template has 2 pages. I'm trying to&nbs=
p;achieve&nbsp;to get the first page of the template on the first page of t=
he new generated pdf and the second page of the template on all following p=
ages of the new generated pdf. First step is no Problem. I'm generating a p=
df with this:</div>
<div><br></div><div>Prawn::Document.generate(<wbr>filename, :page_size =3D&=
gt; "A4", :skip_page_creation =3D&gt; true) do |pdf|<br></div><div><br></di=
v><div># Afterwards i set the template for the first site like this:</div>
<div><br></div><div>pdf.start_new_page(:template =3D&gt; path_to_template, =
template_page =3D&gt; 1)<br></div><div><br></div><div>Now i'm generating co=
ntent. And this content is getting longer and longer... At some point a new=
 page is automatically generated, but without any template.&nbsp;Because of=
 not running the method #start_new_page on the second page, i have no templ=
ate. Just a Guess!</div>
<div><br></div><div>The Question is: &nbsp;But how is it possible to define=
 :template for following pages, which are not especially generated by the m=
ethod #start_new_page? Did i miss something? I'm happy about every bit of i=
nformation.</div>
<div><br></div><div>Cheers, Georg&nbsp;</div></blockquote></div><br></div>
</blockquote></div></div>
------=_Part_275_20008958.1340382597617--

------=_Part_274_8166694.1340382597617--