TOPIC:

pdf_attachment.php 3 years 10 months ago #215811

  • Topic Author
  • Be@t
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 1
Nach dem Ausfüllen des Formulars erhält der Kunde einen personalisierten Gutschein als PDF zugeschickt. Soweit funktioniert das auch zufriedenstellend. Ich möchte jedoch die Randabstände der PDF-Datei bestimmen können. In der Standard-Konfiguration betragen die Ränder nach dem Ausdruck auf ein A4-Papier oben und unten je 2,5cm. links und rechts je 1,5cm. Wie kann ich diese Randabstände verändern? Ich möchte überall je 1,5cm.

Und noch eine zweite Frage: Kann man den Namen des PDF-Dokuments beeinflussen? ffexport-pdf-20171113142514-1789060932.pdf wirkt wenig sexy... Besser wäre z.B. Gutschein-{$gsnr:value;}.pdf


Im Anhang meine aktuelle pdf_attachment.php-Konfiguration (als txt)
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by Be@t.

pdf_attachment.php 3 years 10 months ago #215897

  • marko.bosnjak
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2222
  • Karma: 44
  • Thanks: 279
Hello Be@t,

sorry to answer you in English, but we are currently little short on German speaking supporters. As far as i understand, you're having 2 requests:

1) You want to change the margins.
2) You want to change the name of the PDF attachment.

1) BF uses the TCPDF library for generating PDF documents.
The PDF templates are intended to have an A4 format, but with a little hack you can choose all available formats as of the TCPDF library (tcpdf.org).
Navigate to /components/com_breezingforms/facileforms.process.php and find this line:
$pdf->AddPage();
To get an A5 format, you can use this code:
$pdf->AddPage('','A5');
To get a list of all supported formats, please visit the tcpdf.org/ .
There is probably more upon the page creation like setting margins, that should be covered by the TCPDF documentation.

2) Please follow this topic: crosstec.org/en/forums/41-breezingforms-...-dropbox.html#194250
It has been updated to the newest version of BF.

Let me know if you need anything else.

Regards,
Marko
======================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
======================================
Need to renew Pro Support?
Buy Here!
======================================
Satisfied?
Consider a Membership!
======================================
Follow us on Facebook!

Please Log in or Create an account to join the conversation.

pdf_attachment.php 3 years 10 months ago #215950

  • Topic Author
  • Be@t
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 1
Thank you for your answer.

1.) regarding the margins of the generated pdf. I could not find a solution yet.
2.) regarding the pdf-naming I tryed a lot with the following code in facileforms.process.php
foreach($xmldata as $data){

            if ($data[_FF_DATA_TITLE]== "Ihr Gutschein Code:"){$gsnr_n=$data[_FF_DATA_VALUE];}

                }
                if($this->formrow->name=='GS_normal'){
                $pdfname = $this->uploads . '/Rikscha-Gutschein-Nr_' . $gsnr_n . '.pdf';
                }
                else{
                $pdfname = $this->uploads . '/ffexport-pdf-' . $date_stamp . '-' . mt_rand(0, mt_getrandmax()) . '.pdf';
            }

		foreach($xmldata as $data){

            if ($data[_FF_DATA_TITLE]== "Ihr Gutschein Code:"){$gsnr_r=$data[_FF_DATA_VALUE];}

                }
                if($this->formrow->name=='GS_romantik'){
                $pdfname = $this->uploads . '/Rikscha-Gutschein-Nr_' . $gsnr_r . '.pdf';
                }
                else{
                $pdfname = $this->uploads . '/ffexport-pdf-' . $date_stamp . '-' . mt_rand(0, mt_getrandmax()) . '.pdf';
            }

It's working for GS_romantik but not for GS_normal. I can reproduce the following behavior: It's always working for the second entry, but not for the first one. If I switch position, GS_normal gets the right name, but GS_romantik not. It seems that some code have to be changed, but I don't have the necessary skills.

And in my case, I don't need the data title, I need only the values of the fields $gsnr_n and $gsnr_r.

Best solution would be even simpler: Both fields (gsnr_n & gsnr_r) are automatically generated with a random value. To eliminate same values I would prefer to have only one filed (e.g. gsnr) for both forms. The naming convention of the pdf is equal for both forms (Rikscha-Gutschein-Nr_$gsnr),

Please Log in or Create an account to join the conversation.

Last edit: Post by Be@t.

pdf_attachment.php 3 years 10 months ago #215967

  • Topic Author
  • Be@t
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 1
Comming back to the margins.

I tryed this:
	$pdf->SetMargins(10, 0, 10);
        $pdf->AddPage();

Works. Disadvantage: Somewhere is an automated page-break definied. With the above code I get a blank first page and my desired pdf-content is on page 2 (with the right margins).

I tryed manytimes, but I cannot remove page 1.

I really believe that page settings and auto-page-break is somewhere else definied. Not in facileforms.process.php

Please Log in or Create an account to join the conversation.

pdf_attachment.php 3 years 10 months ago #216048

  • Topic Author
  • Be@t
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 1
OK. PDF-settings and margins are now solved.

The problem with the PDF-naming still exist. Can you please figure out, why the first form ends always with: "else" result?

To make it clear: Whenever I change the "foreach"-positions, the first form returs with "else" and the second form with "if". So it'not a typo-failure
Here is the code I use again:
        $pdf->writeHTML($c);
        mt_srand();
        //$pdfname = $this->uploads . '/ffexport-pdf-' . $date_stamp . '-' . mt_rand(0, mt_getrandmax()) . '.pdf';//

			foreach($xmldata as $data){

				if ($data[_FF_DATA_TITLE]== "Ihr Gutschein Code:"){$gsnr_r=$data[_FF_DATA_VALUE];}

            }
					if($this->formrow->name=='GS_romantik'){
					$pdfname = $this->uploads . '/Rikscha-Gutschein-Nr_' . $gsnr_r . '.pdf';
					}
					else{
					$pdfname = $this->uploads . '/ffexport-pdf-' . $date_stamp . '-' . mt_rand(0, mt_getrandmax()) . '.pdf';
					}			
			
			foreach($xmldata as $data){

				if ($data[_FF_DATA_TITLE]== "GS_Code"){$gsnr_n=$data[_FF_DATA_VALUE];}

			}
					if($this->formrow->name=='GS_normal'){
					$pdfname = $this->uploads . '/Rikscha-Gutschein-Nr_' . $gsnr_n . '.pdf';
					}
					else{
					$pdfname = $this->uploads . '/ffexport-pdf-' . $date_stamp . '-' . mt_rand(0, mt_getrandmax()) . '.pdf';
					}    

Please Log in or Create an account to join the conversation.

pdf_attachment.php 3 years 10 months ago #216056

  • Topic Author
  • Be@t
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 1
O.K. I admit... :unsure:if I had read earlier to the end of the mentioned trhead, I would have recognized that the solution is elseif

So all probles are solved. Thread can be closed.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.045 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!