Forums

TCPDF export image

Raimis 11 Nov, 2015
how make export image in pdf ?
why cannot see image in pdf with code <img src='.../images/no-photo.png' /> ?
GreyHead 11 Nov, 2015
Hi Raimis,

Please try with the full url not the . . . / version

Bob
Raimis 11 Nov, 2015
Yes, i try with full
<img src='http://myserver.lt/images/no-photo.png' />

This is private content

GreyHead 11 Nov, 2015
Hi Raimis,

I don't see any trace of the image html in the PDF source at all. Please try once more with double quotes "" instead of ''

Bob
Raimis 11 Nov, 2015
pls check now.

here code wit diuble quotes :

Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in /home/galex/domains/galex.lt/public_html/administrator/components/com_chronoforms5/chronoforms/actions/tcpdf/tcpdf/tcpdf.php on line 7542
TCPDF ERROR: Some data has already been output, can't send PDF file


here is my custom code:
<style type="text/css">
table.PersonalInfo1 {
    margin: auto;
}
.PersonalInfoEmpty {
    width: 1px !important;
}
.Title{
    font-weight:bold;
}
table {
  font-size:25px;
}
td.PersonalInfo3,
th.PersonalInfo3,
th.PersonalInfo2, 
td.PersonalInfo2 {
    width: 25%;
    text-align: left;
}
td,
th {
  border: 1px solid #000;
}
th.PersonalInfo1,
td.PersonalInfo1 {
    text-align: left;
    width: 18%;
}
.PersonalPhoto {
    width: 20%;
}
.PersonalInfo2,
.PersonalInfo3 {
    margin: auto;
    text-align: left;
}
.clearfix {
    height: 5px;
}
</style>
Personal Details
<table class="PersonalInfo1">
  <tr>
    <th class="PersonalInfo1 Title">Sign On</th>
    <th class="PersonalInfo1">{info.PersonalSignOn}</th>
    <th class="PersonalInfo1 Title">Position applay</th>
    <th class="PersonalInfo1">{info.PersonalPositionApplay}</th>
    <th class="PersonalPhoto" colspan="1" rowspan="6">
<img src="http://galex.lt.meldas.serveriai.lt/images/no-photo.png" />
    </th>
  </tr>
  <tr>
    <td class="PersonalInfo1 Title">Date of Readines</td>
    <td class="PersonalInfo1">{info.PersonalDateOfReadines}</td>
    <td class="PersonalInfo1 Title">Salarry</td>
    <td class="PersonalInfo1">{info.PersonalSalarry}</td>
  </tr>
  <tr>
    <td class="PersonalInfo1 Title">Rank</td>
    <td class="PersonalInfo1">{info.PersonalRank}</td>
    <td class="PersonalInfo1"></td>
    <td class="PersonalInfo1"></td>
  </tr>
</table>
<div class="clearfix"></div>
<table class="PersonalInfo2">
  <tr>
    <th class="PersonalInfo2 Title">First Name</th>
    <th class="PersonalInfo2">{info.PersonalFirstName}</th>
    <th class="PersonalInfo2 Title">Nationality</th>
    <th class="PersonalInfo2">{info.PersonalNationality}</th>
  </tr>
  <tr>
    <td class="PersonalInfo2 Title">Surname</td>
    <td class="PersonalInfo2">{info.PersonalSurname}</td>
    <td class="PersonalInfo2 Title">No. of children</td>
    <td class="PersonalInfo2">{info.PersonalNoOfChildren}</td>
  </tr>
  <tr>
    <td class="PersonalInfo2 Title">Date of Birth</td>
    <td class="PersonalInfo2">{info.PersonalDateOfBirth}</td>
    <td class="PersonalInfo2 Title">Next of Kin</td>
    <td class="PersonalInfo2">{info.PersonalNextOfKin}</td>    
  </tr>
  <tr>
    <td class="PersonalInfo2 Title">Place of Birth</td>
    <td class="PersonalInfo2">{info.PersonalPlaceOfBirth}</td>
    <td class="PersonalInfo2 Title">Name of Next of Kin</td>
    <td class="PersonalInfo2">{info.PersonalNextOfKin}</td>
  </tr>
  <tr>
    <td class="PersonalInfo2 Title">Home Address</td>
    <td class="PersonalInfo2">{info.PersonalHomeAddress}</td>  
    <td class="PersonalInfo2 Title">Address of Next of Kin</td>
    <td class="PersonalInfo2">{info.PersonalNameOfNextOfKin}</td>
  </tr>
  <tr>
    <td class="PersonalInfo2 Title">Telephone No.</td>
    <td class="PersonalInfo2">{info.PersonalTelephoneNo}</td>
    <td class="PersonalInfo2 Title">Telephone No.</td>
    <td class="PersonalInfo2">{info.PersonalSignOn}</td>
  </tr>
</table>
<table class="PersonalInfo3">
  <tr>
    <th class="PersonalInfo3 Title">Height</th>
    <th class="PersonalInfo3">{info.PersonalHeight}</th>
    <th class="PersonalInfo3 Title">Nearest airport</th>
    <th class="PersonalInfo3">{info.PersonalNearestAirport}</th>
  </tr>
  <tr>
    <td class="PersonalInfo3 Title">Weight</td>
    <td class="PersonalInfo3">{info.PersonalWeight}</td>
    <td class="PersonalInfo3 Title">Email</td>
    <td class="PersonalInfo3">{info.PersonalEmail}</td>
  </tr>
  <tr>
    <td class="PersonalInfo3 Title">Color of Eyes</td>
    <td class="PersonalInfo3">{info.PersonalColorOfEyes}</td> 
    <td class="PersonalInfo3 Title">Skype</td>
    <td class="PersonalInfo3">{info.PersonalSkype}</td>
  </tr>
  <tr>
    <td class="PersonalInfo3 Title">Color of hair</td>
    <td class="PersonalInfo3">{info.PersonalColorOfHair}</td>
    <td class="PersonalInfo3 Title">Viber</td>
    <td class="PersonalInfo3">{info.PersonalViber}</td>
  </tr>
  <tr>
    <td class="PersonalInfo2 Title">Overall size</td>
    <td class="PersonalInfo2">{info.PersonalOverallSize}</td>
    <td class="PersonalInfo2 Title">English language skill level</td>
    <td class="PersonalInfo2">{info.PersonalLanguages}</td>
  </tr>
  <tr>
    <td class="PersonalInfo2 Title">Shoe size</td>
    <td class="PersonalInfo2">{info.PersonalShoeSize}</td>
    <td class="PersonalInfo2 Title">Your Ressume</td>
    <td class="PersonalInfo2">{info.PersonalYourRessume}</td>
  </tr>
</table>
<div class="clearfix"></div>
Travel Document<br />
<table class="TravelDocument">
    <tr>
      <th class="TravelDocument Title">Passport No.</th>
      <th class="TravelDocument Title">Place of issue</th>
      <th class="TravelDocument Title">Date of issue</th>
      <th class="TravelDocument Title">Date of expire</th>
    </tr>
    <tr>
      <th class="TravelDocument">{info.TravelDocumentPassportNo}</th>
      <th class="TravelDocument">{info.TravelDocumentPassportPlaceOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocumentPassportDateOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocumentPassportDateOfExpire}</th>
    </tr>
        <tr>
      <th class="TravelDocument Title">Seaman`s book</th>
      <th class="TravelDocument Title">Place of issue</th>
      <th class="TravelDocument Title">Date of issue</th>
      <th class="TravelDocument Title">Date of expire</th>
    </tr>
    <tr>
      <th class="TravelDocument">{info.TravelDocumentsSeamans}</th>
      <th class="TravelDocument">{info.TravelDocumentSeamansPlaceOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocumentSeamansDateOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocumentSeamansDateOfExpire}</th>
    </tr>
        <tr>
      <th class="TravelDocument Title">Travel doc. No.</th>
      <th class="TravelDocument Title">Place of issue</th>
      <th class="TravelDocument Title">Date of issue</th>
      <th class="TravelDocument Title">Date of expire</th>
    </tr>
    <tr>
      <th class="TravelDocument">{info.TravelDocumentsTravelDocNo}</th>
      <th class="TravelDocument">{info.TravelDocumentsTravelDocPlaceOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocDateOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocDateOfExpire}</th>
    </tr>
        <tr>
      <th class="TravelDocument Title">Travel Documents US visa</th>
      <th class="TravelDocument Title">Place of issue</th>
      <th class="TravelDocument Title">Date of issue</th>
      <th class="TravelDocument Title">Date of expire</th>
    </tr>
    <tr>
      <th class="TravelDocument">{info.TravelDocUsVisaNumber}</th>
      <th class="TravelDocument">{info.TravelDocUsVisaNumberPlaceOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocUsVisaNumberDateOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocUsVisaNumberDateOfExpire}</th>
    </tr>
        <tr>
      <th class="TravelDocument Title">Shengen visa number</th>
      <th class="TravelDocument Title">Place of issue</th>
      <th class="TravelDocument Title">Date of issue</th>
      <th class="TravelDocument Title">Date of expire</th>
    </tr>
    <tr>
      <th class="TravelDocument">{info.TravelDocShengenVisaNumber}</th>
      <th class="TravelDocument">{info.TravelDocShengenVisaPlaceOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocShengenVisaDateOfIssue}</th>
      <th class="TravelDocument">{info.TravelDocShengenVisaDateOfExpire}</th>
    </tr>
</table>
<div class="clearfix"></div>
Licenses<br />
<table class="Licenses">
  <tr>
      <th class="Licenses Title">Licenses</th>
      <th class="Licenses Title">Licenses Number</th>
      <th class="Licenses Title">Place of Issue</th>
      <th class="Licenses Title">Date of Issue</th>
      <th class="Licenses Title">Date of Expire</th>
  </tr>

  <?php

 foreach($form->data['Licenses'] as $list){   
          echo  "<tr><td class='Licenses'>".$list['License']."</td>";
          echo  "<td class='Licenses'>".$list['LicensesNumber']."</td>";
          echo  "<td class='Licenses'>".$list['PlaceOfIssue']."</td>";
          echo  "<td class='Licenses'>".$list['DateOfIssue']."</td>";
          echo  "<td class='Licenses'>".$list['DateOfExpire']."</td></tr>";
 }

?>

</table>
<div class="clearfix"></div>
Endorsements<br />
<table class="Endorsements">
  <tr>
      <th class="Endorsements Title">Nationality</th>
      <th class="Endorsements Title">Grade</th>
      <th class="Endorsements Title">Number</th>
      <th class="Endorsements Title">Place of Issue</th>
      <th class="Endorsements Title">Date of Issue</th>
      <th class="Endorsements Title">Date of Expire</th>
  </tr>

  <?php

 foreach($form->data['Endorsements'] as $list){   
          echo  "<tr><td class='Endorsements'>".$list['Nationality']."</td>";
          echo  "<td class='Endorsements'>".$list['Grade']."</td>";
          echo  "<td class='Endorsements'>".$list['Number']."</td>";
          echo  "<td class='Endorsements'>".$list['PlaceOfIssue']."</td>";
          echo  "<td class='Endorsements'>".$list['DateOfIssue']."</td>";
          echo  "<td class='Endorsements'>".$list['DateOfExpire']."</td></tr>";
 }

?>

</table>
<div class="clearfix"></div>
Certificates<br />
<table class="Certificates">
  <tr>
      <th class="Certificates Title">Certificate</th>
      <th class="Certificates Title">Certificate Number</th>
      <th class="Certificates Title">Place of Issue</th>
      <th class="Certificates Title">Date of Issue</th>
      <th class="Certificates Title">Date of Expire</th>
  </tr>
  <tr>
      <td class="Certificates">BST *</td>
      <td class="Certificates">{info.CertificateNumberBST}</td>
      <td class="Certificates">{info.PlaceOfIssueBST}</td>
      <td class="Certificates">{info.DateOfIssueBST}</td>
      <td class="Certificates">{info.DateOfExpireBST}</td>
  </tr>
  <tr>
      <td class="Certificates">PSSR *</td>
      <td class="Certificates">{info.CertificateNumberPSSR}</td>
      <td class="Certificates">{info.PlaceOfIssuePSSR}</td>
      <td class="Certificates">{info.DateOfIssuePSSR}</td>
      <td class="Certificates">{info.DateOfExpirePSSR}</td>
  </tr>
  <tr>
      <td class="Certificates">PRS *</td>
      <td class="Certificates">{info.CertificateNumberPRS}</td>
      <td class="Certificates">{info.PlaceOfIssuePRS}</td>
      <td class="Certificates">{info.DateOfIssuePRS}</td>
      <td class="Certificates">{info.DateOfExpirePRS}</td>
  </tr>
    <tr>
      <td class="Certificates">AFF *</td>
      <td class="Certificates">{info.CertificateNumberAFF}</td>
      <td class="Certificates">{info.PlaceOfIssueAFF}</td>
      <td class="Certificates">{info.DateOfIssueAFF}</td>
      <td class="Certificates">{info.DateOfExpireAFF}</td>
  </tr>
    <tr>
      <td class="Certificates">DSD *</td>
      <td class="Certificates">{info.CertificateNumberDSD}</td>
      <td class="Certificates">{info.PlaceOfIssueDSD}</td>
      <td class="Certificates">{info.DateOfIssueDSD}</td>
      <td class="Certificates">{info.DateOfExpireDSD}</td>
  </tr>
  <?php

 foreach($form->data['Certificates'] as $list){   
          echo  "<tr><td class='Certificates'>".$list['Certificate']."</td>";
          echo  "<td class='Certificates'>".$list['CertificateNumber']."</td>";
          echo  "<td class='Certificates'>".$list['PlaceOfIssue']."</td>";
          echo  "<td class='Certificates'>".$list['DateOfIssue']."</td>";
          echo  "<td class='Certificates'>".$list['DateOfExpire']."</td></tr>";
 }

?>
<tr><td colspan="5">
    BST * - (Basic Safety Training) (A-VI/1-1;A-VI/1-2;A-VI/1-3;A-VI/1-4)<br />
    PSSR * - (Personal Social & Safety Responsibilities)<br />
    PRS * - Proficiency in Rescue & Survival Crafts (A-VI;2-1)<br />
    AFF * - Advanced Fire Fighting (A-VI/3)<br />
    DSD * - Designated Security Duties (A-VI/6-2)   
</td></tr>
</table>
<div class="clearfix"></div>
Medical Examination<br />
<table class="MedicalExamination">
  <tr>
      <th class="MedicalExamination Title">Place of Issue</th>
      <th class="MedicalExamination Title">Date of Issue</th>
      <th class="MedicalExamination Title">Date of Expire</th>
  </tr>

  <?php

 foreach($form->data['MedicalExamination'] as $list){   
          echo  "<tr><td class='MedicalExamination'>".$list['PlaceOfIssue']."</td>";
          echo  "<td class='MedicalExamination'>".$list['DateOfIssue']."</td>";
          echo  "<td class='MedicalExamination'>".$list['DateOfExpire']."</td></tr>";
 }

?>

</table>
<div class="clearfix"></div>
Vaccination<br />
<table class="Vaccination">
  <tr>
      <th class="Vaccination Title">Vaccination</th>
      <th class="Vaccination Title">Date of Issue</th>
      <th class="Vaccination Title">Date of Expire</th>
  </tr>

  <?php

 foreach($form->data['Vaccination'] as $list){   
          echo  "<tr><td class='Vaccination'>".$list['Vaccination']."</td>";
          echo  "<td class='Vaccination'>".$list['DateOfIssue']."</td>";
          echo  "<td class='Vaccination'>".$list['DateOfExpire']."</td></tr>";
 }

?>

</table>
<div class="clearfix"></div>
Sea Services<br />
<table class="SeaServices">
  <tr>
      <th class="SeaServices Title">Name of Vessel</th>
      <th class="SeaServices Title">Type of Vessel</th>
      <th class="SeaServices Title">Flag</th>
      <th class="SeaServices Title">DWT</th>
      <th class="SeaServices Title">Type of ME/kW</th>
      <th class="SeaServices Title">Position on board</th>
      <th class="SeaServices Title">Sign on</th>
      <th class="SeaServices Title">Sign off</th>
      <th class="SeaServices Title">Company`s Name & Contact Phone Number</th>
  </tr>

  <?php

 foreach($form->data['SeaServices'] as $list){   
          echo  "<tr><td class='SeaServices'>".$list['NameOfVessel']."</td>";
          echo  "<td class='SeaServices'>".$list['TypeOfVessel']."</td>";
          echo  "<td class='SeaServices'>".$list['Flag']."</td>";
          echo  "<td class='SeaServices'>".$list['DWT']."</td>";
          echo  "<td class='SeaServices'>".$list['TypeOfMeKw']."</td>";
          echo  "<td class='SeaServices'>".$list['PositionOnBoard']."</td>";
          echo  "<td class='SeaServices'>".$list['SignOn']."</td>";
          echo  "<td class='SeaServices'>".$list['SignOff']."</td>";
          echo  "<td class='SeaServices'>".$list['CompanysInfo']."</td></tr>";
 }

?>

</table>
<div class="clearfix"></div>
Flag State Seamans Book`s<br />
<table class="FlagStateSeamansBooks">
  <tr>
      <th class="FlagStateSeamansBooks Title">Nationality</th>
      <th class="FlagStateSeamansBooks Title">Number</th>
      <th class="FlagStateSeamansBooks Title">Date of Issue</th>
      <th class="FlagStateSeamansBooks Title">Date of Expire</th>
  </tr>

  <?php

 foreach($form->data['FlagStateSeamansBooks'] as $list){   
          echo  "<tr><td class='FlagStateSeamansBooks'>".$list['Nationality']."</td>";
          echo  "<td class='FlagStateSeamansBooks'>".$list['Number']."</td>";
          echo  "<td class='FlagStateSeamansBooks'>".$list['DateOfIssue']."</td>";
          echo  "<td class='FlagStateSeamansBooks'>".$list['DateOfExpire']."</td></tr>";
 }

?>

</table>
<div class="clearfix"></div>
Offshore Certificates<br />
<table class="OffshoreCertificates">
  <tr>
      <th class="OffshoreCertificates Title">Offshore Certificates</th>
      <th class="OffshoreCertificates Title">Offshore Certificate Number</th>
      <th class="OffshoreCertificates Title">Place of Issue</th>
      <th class="OffshoreCertificates Title">Date of Issue</th>
      <th class="OffshoreCertificates Title">Date of Expire</th>
  </tr>
  <?php

 foreach($form->data['OffshoreCertificates'] as $list){   
          echo  "<tr><td class='OffshoreCertificates'>".$list['OffshoreCertificates']."</td>";
          echo  "<td class='OffshoreCertificates'>".$list['Number']."</td>";
          echo  "<td class='OffshoreCertificates'>".$list['PlaceOfIssue']."</td>";
          echo  "<td class='OffshoreCertificates'>".$list['DateOfIssue']."</td>";
          echo  "<td class='OffshoreCertificates'>".$list['DateOfExpire']."</td></tr>";
 }

?>
</table>
GreyHead 11 Nov, 2015
Hi Raimis,

I tested this and it works OK as far as I can see.

In the TCPDF template

<p><img src="http://g---x.lt.me---ai.lt/images/no-photo.png" /></p>

And here's the PDF
[attachment=0]2015-11-11_17-27-46.png[/attachment]

Bob
Raimis 11 Nov, 2015
hmm if i try this your code get error:

Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in /home/galex/domains/galex.lt/public_html/administrator/components/com_chronoforms5/chronoforms/actions/tcpdf/tcpdf/tcpdf.php on line 7542
TCPDF ERROR: Some data has already been output, can't send PDF file


if i try this code with ' quote my PDF show header and in content nothing just blank :/
Raimis 11 Nov, 2015
you can try form name: PDF-ApplicationForm

This is private content

GreyHead 11 Nov, 2015
Hi Raimis,

Does the same error show if you save the pdf file to the server and don't display or download it immediately?

Bob
Raimis 12 Nov, 2015
hmm, same... :/
GreyHead 12 Nov, 2015
Hi Raimis,

Please take a Form Backup using the icon in the Forms Manager and post it here and I'll take a closer look.

Bob
GreyHead 12 Nov, 2015
Hi Raimis,

A few things here.

a) The src URL needs to be in double quotes.
b) Site Error Reporting needs to be set to System Default or None. The error message you see is caused when TCPDF tries to re-size the image to fit into the table. Once the message has been sent by PHP it breaks the PDF creation.

Bob
Raimis 12 Nov, 2015
thanks Bob,

thanks Bob, Site Error Reporting : none; work fine. But why errors? in future i want see errors from joomla.
GreyHead 12 Nov, 2015
Hi Raimis,

The error message you see is caused when TCPDF tries to re-size the image to fit into the table. Once the message has been sent by PHP it breaks the PDF creation.

You could possibly update the TCPDF library to a more recent version - that should get rid of the error I see which is about a deprecated ImgMagik function.

Bob
This topic is locked and no more replies can be posted.