Solved

emailing PDF as attachment - but PDF needs to be 2 pages long

Posted on 2006-07-15
4
496 Views
Last Modified: 2008-03-17
hi - the pdf i'm creating needs to be 2 pages - i'm really just trying to manipulate this code - i didn't write it and i don't have much of a handle on it - anyway, my question is - how do you generate additional pdf pages - my pdf starts at 750 and works its way down when i got to 0 i started using negative numbers (just a clunky guess) - and, of course, my idea isn't working.

the code in question:

<?php

@ require ('var.php');
require ('validation.php');

$company = 'Texas Spine & Joint Hospital';
$companyadd = '3414 Golden Rd. Tyler, TX 75701';
$companyphone = '(903) 597-0601';
$today = date('F d, Y');
$patient = ($personnal[1] . ' ' . $personnal[0]);
$filename = ($personnal[0] . '_' . $personnal[1]);

  //create file
 $pdf = pdf_new();
 
 pdf_open_file($pdf, '');
 
  pdf_set_info($pdf, "Creator", "Bill Hamilton");
  pdf_set_info($pdf, "Author", "Chris Richter");
  pdf_set_info($pdf, "Title", "Texas Spine & Joint Hospital");

  // US letter dimensions at 8 1/2 by 11
  pdf_begin_page($pdf, 8.5*72, 11*72);
 
  pdf_add_bookmark($pdf, ($personnal[1] . ' ' . $personnal[0]), 0, 0);
 
  $font = pdf_findfont($pdf, 'Times-Bold', 'host', 0);//Section Titles
  $font1 = pdf_findfont($pdf, 'Times-Roman', 'host', 0);//User Info
  $font2 = pdf_findfont($pdf, 'Helvetica-Oblique', 'host', 0);//Row Titles

$column1 = 50;
$column2 = 310;
$infocolumn1 = 150;
$infocolumn2 = 410;

$header = 36;

//COMPANY INFORMATION COMPANY INFORMATION
pdf_setfont($pdf, $font, 12);//bold font for company name
pdf_show_xy($pdf, $company, 36, 750);

pdf_setfont($pdf, $font1, 12); //non-bold font
pdf_show_xy($pdf, $today, 450, 750);
pdf_show_xy($pdf, $companyadd, 36, 737);
pdf_show_xy($pdf, $companyphone, 36, 724);

pdf_setfont($pdf, $font, 18);
pdf_show_xy($pdf, 'Patient Pre-Registration Form', 185, 705);

//Begin Column One
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'General Information', $header, 680);

//General Information
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Expected Procedure Date', $column1, 665);

//Personal Information H1
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Patient Information', $header, 645);

//Personal Information Headings
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Last Name', $column1, 630);
pdf_show_xy($pdf, 'Maiden Name', $column1, 615);
pdf_show_xy($pdf, 'Address', $column1, 600);
pdf_show_xy($pdf, '-', $column1, 585);
pdf_show_xy($pdf, 'City', $column1, 570);
pdf_show_xy($pdf, 'State', $column1, 555);
pdf_show_xy($pdf, 'Social Security #', $column1, 540);
pdf_show_xy($pdf, 'Home Phone', $column1, 525);

pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Patient Employment Information', $header, 505);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Employment Status', $column1, 485);
pdf_show_xy($pdf, 'Occupation', $column1, 470);
pdf_show_xy($pdf, 'City', $column1, 455);
pdf_show_xy($pdf, 'Zip Code', $column1, 440);

pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Physician Information', $header, 420);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Admitting Physician', $column1, 400);

pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Guarantor Information (Person Responsible for Billing)', $header, 380);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Last Name', $column1, 360);
pdf_show_xy($pdf, 'Relationship', $column1, 345);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'to patient', $column1, 335);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Address', $column1, 320);
pdf_show_xy($pdf, ' - ', $column1, 305);

pdf_show_xy($pdf, 'City', $column1, 290);
pdf_show_xy($pdf, 'State', $column1, 275);
pdf_show_xy($pdf, 'Zip', $column1, 260);
pdf_show_xy($pdf, 'Employer', $column1, 245);

//Begin Relative/Next Of Kin
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Relative/Next of Kin', $header, 225);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Name', $column1, 205);
pdf_show_xy($pdf, 'Relationship', $column1, 190);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'to patient', $column1, 180);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Address', $column1, 165);
pdf_show_xy($pdf, '-', $column1, 150);
pdf_show_xy($pdf, 'City', $column1, 135);
pdf_show_xy($pdf, 'State', $column1, 120);
pdf_show_xy($pdf, 'Zip Code', $column1, 105);
//End Relative/Next Of Kin

//Begin Primary Insurance
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Primary Insurance Information', $header, 85);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Insurance Carrier', $column1, 65);
pdf_show_xy($pdf, 'Name of Insured', $column1, 50);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'if not patient', $column1, 40);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'SSN', $column1, 25);
pdf_show_xy($pdf, 'Subscriber DOB', $column1, 10);
pdf_show_xy($pdf, 'Group Number', $column1, -5);
pdf_show_xy($pdf, 'Group Name', $column1, -20);
pdf_show_xy($pdf, 'Claims Mailing Address', $column1, -35);
pdf_show_xy($pdf, '-', $column1, -50);
pdf_show_xy($pdf, 'City', $column1, -65);
pdf_show_xy($pdf, 'State', $column1, -80);
pdf_show_xy($pdf, 'Zip Code', $column1, -95);
//End Primary Insurance

//Begin Secondary Insurance
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Secondary Insurance Information', $header, -115);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Insurance Carrier', $column1, -135);
pdf_show_xy($pdf, 'Name of Insured', $column1, -150);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'if not patient', $column1, -160);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'SSN', $column1, -175);
pdf_show_xy($pdf, 'Subscriber DOB', $column1, -190);
pdf_show_xy($pdf, 'Group Number', $column1, -205);
pdf_show_xy($pdf, 'Group Name', $column1, -220);
pdf_show_xy($pdf, 'Claims Mailing Address', $column1, -235);
pdf_show_xy($pdf, '-', $column1, -250);
pdf_show_xy($pdf, 'City', $column1, -265);
pdf_show_xy($pdf, 'State', $column1, -280);
pdf_show_xy($pdf, 'Zip Code', $column1, -295);
//End Secondary Insurance



//beginning of second column headings

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'First Name, MI', $column2, 630);
pdf_show_xy($pdf, 'Date of Birth', $column2, 615);
pdf_show_xy($pdf, 'Age', $column2, 600);
pdf_show_xy($pdf, 'Sex', $column2, 585);
pdf_show_xy($pdf, 'Zip Code', $column2, 570);
pdf_show_xy($pdf, 'Martial Status', $column2, 555);
pdf_show_xy($pdf, 'Race/Ethnic Background', $column2, 540);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Employer/School Name', $column2, 485);
pdf_show_xy($pdf, 'Work Phone', $column2, 470);
pdf_show_xy($pdf, 'State', $column2, 455);

//physician informaton - craig
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Primary Care Physician', $column2, 400);

//billing information
pdf_show_xy($pdf, 'First Name, MI', $column2, 360);
pdf_show_xy($pdf, 'SSN', $column2, 345);
pdf_show_xy($pdf, 'DOB', $column2, 320);
pdf_show_xy($pdf, 'Home Phone', $column2, 305);
pdf_show_xy($pdf, 'Occupation', $column2, 290);
pdf_show_xy($pdf, 'Employment Status', $column2, 275);
pdf_show_xy($pdf, 'Work Phone', $column2, 260);

//Relative/Next of Kin (col 2)
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Home Phone', $column2, 205);
pdf_show_xy($pdf, 'Marital Status', $column2, 190);
pdf_show_xy($pdf, 'Work Phone', $column2, 165);
pdf_show_xy($pdf, 'Employer', $column2, 150);
//End Relative Next of kin (col 2)

//Begin Primary Insurance (col 2)
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Plan Name', $column2, 65);
pdf_show_xy($pdf, 'Patient Relationship', $column2, 50);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'to insured', $column2, 40);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Insured Sex', $column2, 25);
pdf_show_xy($pdf, 'Policy Number', $column2, 10);
pdf_show_xy($pdf, 'Pre-Cert/Auth Phone', $column2, -5);
pdf_show_xy($pdf, 'Benefits Phone', $column2, -20);
//End Primary Insurance (col 2)

//Begin Secondary Insurance (col 2)
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Plan Name', $column2, -135);
pdf_show_xy($pdf, 'Patient Relationship', $column2, -150);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'to insured', $column2, -160);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Insured Sex', $column2, -175);
pdf_show_xy($pdf, 'Policy Number', $column2, -190);
pdf_show_xy($pdf, 'Pre-Cert/Auth Phone', $column2, -205);
pdf_show_xy($pdf, 'Benefits Phone', $column2, -220);
//End Primary Insurance (col 2)


//begin user information column 1
pdf_setfont($pdf, $font1, 14); //non-bold font
pdf_show_xy($pdf, $personnal[0],   $infocolumn1, 630);
pdf_show_xy($pdf, $personnal[2],   $infocolumn1, 615);
pdf_show_xy($pdf, $personnal[4],   $infocolumn1, 600);
pdf_show_xy($pdf, $personnal[5],   $infocolumn1, 585);
pdf_show_xy($pdf, $personnal[8],   $infocolumn1, 570);
pdf_show_xy($pdf, $personnal[9],   $infocolumn1, 555);
pdf_show_xy($pdf, $personnal[11],  $infocolumn1, 540);
pdf_show_xy($pdf, $personnal[13],  $infocolumn1, 525);

//begin user information column 2
pdf_show_xy($pdf, $personnal[1],  $infocolumn2, 630);
pdf_show_xy($pdf, $personnal[3],  $infocolumn2, 615);
pdf_show_xy($pdf, $personnal[6],  $infocolumn2, 600);
pdf_show_xy($pdf, $personnal[7],  $infocolumn2, 585);
pdf_show_xy($pdf, $personnal[10], $infocolumn2, 570);
pdf_show_xy($pdf, $personnal[12], $infocolumn2, 555);
pdf_show_xy($pdf, $personnal[14], $infocolumn2, 540);

//begin employment information column 1
pdf_show_xy($pdf, $employment[0],  $infocolumn1, 485);
pdf_show_xy($pdf, $employment[2],  $infocolumn1, 470);
pdf_show_xy($pdf, $employment[4],  $infocolumn1, 455);
pdf_show_xy($pdf, $employment[6],  $infocolumn1, 440);
//begin employment information column 2
pdf_show_xy($pdf, $employment[1], $infocolumn2, 485);
pdf_show_xy($pdf, $employment[3], $infocolumn2, 470);
pdf_show_xy($pdf, $employment[5], $infocolumn2, 455);


//begin physician information column 1
pdf_show_xy($pdf, $physician[0],  $infocolumn1, 400);

//begin physician information column 2
pdf_show_xy($pdf, $physician[1], $infocolumn2, 400);

//begin financial information column 1
pdf_show_xy($pdf, $financial[0],  $infocolumn1, 360);
pdf_show_xy($pdf, $financial[2],  $infocolumn1, 345);
pdf_show_xy($pdf, $financial[4],  $infocolumn1, 320);
pdf_show_xy($pdf, $financial[5],  $infocolumn1, 305);
pdf_show_xy($pdf, $financial[7],  $infocolumn1, 290);
pdf_show_xy($pdf, $financial[9],  $infocolumn1, 275);
pdf_show_xy($pdf, $financial[11], $infocolumn1, 260);
pdf_show_xy($pdf, $financial[13], $infocolumn1, 245);


//begin financial information column 2
pdf_show_xy($pdf, $financial[1],  $infocolumn2, 360);
pdf_show_xy($pdf, $financial[3],  $infocolumn2, 345);
pdf_show_xy($pdf, $financial[6],  $infocolumn2, 320);
pdf_show_xy($pdf, $financial[8],  $infocolumn2, 305);
pdf_show_xy($pdf, $financial[10], $infocolumn2, 275);
pdf_show_xy($pdf, $financial[12], $infocolumn2, 260);
pdf_show_xy($pdf, $financial[14], $infocolumn2, 245);

//begin emergency information column 1
pdf_show_xy($pdf, $emergency[0],  $infocolumn1, 205);
pdf_show_xy($pdf, $emergency[2],  $infocolumn1, 190);
pdf_show_xy($pdf, $emergency[4],  $infocolumn1, 165);
pdf_show_xy($pdf, $emergency[5],  $infocolumn1, 150);
pdf_show_xy($pdf, $emergency[7],  $infocolumn1, 135);
pdf_show_xy($pdf, $emergency[9],  $infocolumn1, 120);
pdf_show_xy($pdf, $emergency[10], $infocolumn1, 105);

//begin emergency information column 2
pdf_show_xy($pdf, $emergency[1],  $infocolumn2, 205);
pdf_show_xy($pdf, $emergency[3],  $infocolumn2, 190);
pdf_show_xy($pdf, $emergency[6],  $infocolumn2, 165);
pdf_show_xy($pdf, $emergency[8],  $infocolumn2, 150);

//begin insurance information column 1
pdf_show_xy($pdf, $insurance[0],  $infocolumn1, 65);
pdf_show_xy($pdf, $insurance[2],  $infocolumn1, 50);
pdf_show_xy($pdf, $insurance[4],  $infocolumn1, 25);
pdf_show_xy($pdf, $insurance[6],  $infocolumn1, 10);
pdf_show_xy($pdf, $insurance[7],  $infocolumn1, -5);
pdf_show_xy($pdf, $insurance[9],  $infocolumn1, -20);
pdf_show_xy($pdf, $insurance[10],  $infocolumn1, -35);
pdf_show_xy($pdf, $insurance[11],  $infocolumn1, -50);
pdf_show_xy($pdf, $insurance[13],  $infocolumn1, -65);
pdf_show_xy($pdf, $insurance[15],  $infocolumn1, -80);
pdf_show_xy($pdf, $insurance[16],  $infocolumn1, -95);

//begin insurance information column 2
pdf_show_xy($pdf, $insurance[1],  $infocolumn2, 65);
pdf_show_xy($pdf, $insurance[3],  $infocolumn2, 50);
pdf_show_xy($pdf, $insurance[5],  $infocolumn2, 25);
pdf_show_xy($pdf, $insurance[8],  $infocolumn2, 10);
pdf_show_xy($pdf, $insurance[12],  $infocolumn2, -5);
pdf_show_xy($pdf, $insurance[14],  $infocolumn2, -20);
//end insurance information column 2

//begin secondary insurance information column 1
pdf_show_xy($pdf, $secondaryinsurance[0],  $infocolumn1, -135);
pdf_show_xy($pdf, $secondaryinsurance[2],  $infocolumn1, -150);
pdf_show_xy($pdf, $secondaryinsurance[4],  $infocolumn1, -175);
pdf_show_xy($pdf, $secondaryinsurance[6],  $infocolumn1, -190);
pdf_show_xy($pdf, $secondaryinsurance[7],  $infocolumn1, -205);
pdf_show_xy($pdf, $secondaryinsurance[9],  $infocolumn1, -220);
pdf_show_xy($pdf, $secondaryinsurance[10],  $infocolumn1, -235);
pdf_show_xy($pdf, $secondaryinsurance[11],  $infocolumn1, -250);
pdf_show_xy($pdf, $secondaryinsurance[13],  $infocolumn1, -265);
pdf_show_xy($pdf, $secondaryinsurance[15],  $infocolumn1, -280);
pdf_show_xy($pdf, $secondaryinsurance[16],  $infocolumn1, -295);

//begin secondary insurance information column 2
pdf_show_xy($pdf, $secondaryinsurance[1],  $infocolumn2, -135);
pdf_show_xy($pdf, $secondaryinsurance[3],  $infocolumn2, -150);
pdf_show_xy($pdf, $secondaryinsurance[5],  $infocolumn2, -175);
pdf_show_xy($pdf, $secondaryinsurance[8],  $infocolumn2, -190);
pdf_show_xy($pdf, $secondaryinsurance[12],  $infocolumn2, -205);
pdf_show_xy($pdf, $secondaryinsurance[14],  $infocolumn2, -220);


  // end the document
  pdf_end_page($pdf);
  pdf_close($pdf);

################################################################################
################################################################################
//output to e-mail
//output to e-mail
 
// create the file to be e-mailed
$data = pdf_get_buffer($pdf);
$file = $filename . '.pdf';
$fp = fopen($file, 'w+');

fwrite($fp, $data);
fclose($fp);

require_once('../register/mail/htmlMimeMail.php');

$mail = new htmlMimeMail();

$mail->setFrom("TSJHPre-Registration");

$mail->setSubject('Pre-Registration Form');

$attachment = $mail->getFile($file);

$mail->setText('You have received this automated
mailing from the Texas Spine & Joint Hospital web site.
Please do not respond to this email. This message
contains an attached pdf registration form for patient '.$patient.'.
Thank-You.... Have a good day!');

      $mail->addAttachment($attachment, $file, 'application/pdf');

$mail->send(array('elkinhimer@sbcglobal.net'));

//destroy the file that was e-mailed
unlink($file);

################################################################################
################################################################################
//output to web browser
//output to web browser

header ('Location: https://www.tsjh.org/contact/thanks.html');


// header  ('Content-Type: Application/pdf');
// header  ('Content-Disposition: inline; filemane=$file');
// header  ('Conten-Length: ' . strlen($data));
   
//echo $data;


?>
0
Comment
Question by:phillystyle123
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
NetExpert earned 500 total points
ID: 17116267
After pdf_end_page() call pdf_begin_page() again (with reference to your $pdf variable, such as pdf_begin_page($pdf, 8.5*72, 11*72);) to add a new page, and you start writing the new page as with the first one (specifize dimension, font, etc, write content into position).


0
 

Author Comment

by:phillystyle123
ID: 17125141
i think i've got the code in all the right places (according to your instructions but formpdf.php is still not loading - just getting a blank page

http://www.tsjh.org/register/formpdf.php

here's the code - if you look for

"BEGIN 2ND PAGE OF PDF"

you'll see where i've put the code for the 2nd pdf page

thanks for the help!
0
 

Author Comment

by:phillystyle123
ID: 17133666
yikes! forgot to paste the code - once again search for

"BEGIN 2ND PAGE OF PDF"

and you'll see where i added the 2nd page

code:

<?php

@ require ('var.php');
require ('validation.php');

$company = 'Texas Spine & Joint Hospital';
$companyadd = '3414 Golden Rd. Tyler, TX 75701';
$companyphone = '(903) 597-0601';
$today = date('F d, Y');
$patient = ($personnal[1] . ' ' . $personnal[0]);
$filename = ($personnal[0] . '_' . $personnal[1]);

  //create file
 $pdf = pdf_new();
 
 pdf_open_file($pdf, '');
 
  pdf_set_info($pdf, "Creator", "Bill Hamilton");
  pdf_set_info($pdf, "Author", "Chris Richter");
  pdf_set_info($pdf, "Title", "Texas Spine & Joint Hospital");

  // US letter dimensions at 8 1/2 by 11
  pdf_begin_page($pdf, 8.5*72, 11*72);
 
  pdf_add_bookmark($pdf, ($personnal[1] . ' ' . $personnal[0]), 0, 0);
 
  $font = pdf_findfont($pdf, 'Times-Bold', 'host', 0);//Section Titles
  $font1 = pdf_findfont($pdf, 'Times-Roman', 'host', 0);//User Info
  $font2 = pdf_findfont($pdf, 'Helvetica-Oblique', 'host', 0);//Row Titles

$column1 = 50;
$column2 = 310;
$infocolumn1 = 150;
$infocolumn2 = 410;

$header = 36;

//COMPANY INFORMATION COMPANY INFORMATION
pdf_setfont($pdf, $font, 12);//bold font for company name
pdf_show_xy($pdf, $company, 36, 750);

pdf_setfont($pdf, $font1, 12); //non-bold font
pdf_show_xy($pdf, $today, 450, 750);
pdf_show_xy($pdf, $companyadd, 36, 737);
pdf_show_xy($pdf, $companyphone, 36, 724);

pdf_setfont($pdf, $font, 18);
pdf_show_xy($pdf, 'Patient Pre-Registration Form', 185, 705);

//Begin Column One
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'General Information', $header, 680);

//General Information
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Expected Procedure Date', $column1, 665);

//Personal Information H1
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Patient Information', $header, 645);

//Personal Information Headings
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Last Name', $column1, 630);
pdf_show_xy($pdf, 'Maiden Name', $column1, 615);
pdf_show_xy($pdf, 'Address', $column1, 600);
pdf_show_xy($pdf, '-', $column1, 585);
pdf_show_xy($pdf, 'City', $column1, 570);
pdf_show_xy($pdf, 'State', $column1, 555);
pdf_show_xy($pdf, 'Social Security #', $column1, 540);
pdf_show_xy($pdf, 'Home Phone', $column1, 525);

pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Patient Employment Information', $header, 505);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Employment Status', $column1, 485);
pdf_show_xy($pdf, 'Occupation', $column1, 470);
pdf_show_xy($pdf, 'City', $column1, 455);
pdf_show_xy($pdf, 'Zip Code', $column1, 440);

pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Physician Information', $header, 420);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Admitting Physician', $column1, 400);

pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Guarantor Information (Person Responsible for Billing)', $header, 380);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Last Name', $column1, 360);
pdf_show_xy($pdf, 'Relationship', $column1, 345);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'to patient', $column1, 335);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Address', $column1, 320);
pdf_show_xy($pdf, '-', $column1, 305);

pdf_show_xy($pdf, 'City', $column1, 290);
pdf_show_xy($pdf, 'State', $column1, 275);
pdf_show_xy($pdf, 'Zip', $column1, 260);
pdf_show_xy($pdf, 'Employer', $column1, 245);

//Begin Relative/Next Of Kin
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Relative/Next of Kin', $header, 225);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Name', $column1, 205);
pdf_show_xy($pdf, 'Relationship', $column1, 190);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'to patient', $column1, 180);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Address', $column1, 165);
pdf_show_xy($pdf, '-', $column1, 150);
pdf_show_xy($pdf, 'City', $column1, 135);
pdf_show_xy($pdf, 'State', $column1, 120);
pdf_show_xy($pdf, 'Zip Code', $column1, 105);
//End Relative/Next Of Kin

//beginning of second column headings

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'First Name, MI', $column2, 630);
pdf_show_xy($pdf, 'Date of Birth', $column2, 615);
pdf_show_xy($pdf, 'Age', $column2, 600);
pdf_show_xy($pdf, 'Sex', $column2, 585);
pdf_show_xy($pdf, 'Zip Code', $column2, 570);
pdf_show_xy($pdf, 'Martial Status', $column2, 555);
pdf_show_xy($pdf, 'Race/Ethnic Background', $column2, 540);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Employer/School Name', $column2, 485);
pdf_show_xy($pdf, 'Work Phone', $column2, 470);
pdf_show_xy($pdf, 'State', $column2, 455);

//physician informaton - craig
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Primary Care Physician', $column2, 400);

//billing information
pdf_show_xy($pdf, 'First Name, MI', $column2, 360);
pdf_show_xy($pdf, 'SSN', $column2, 345);
pdf_show_xy($pdf, 'DOB', $column2, 320);
pdf_show_xy($pdf, 'Home Phone', $column2, 305);
pdf_show_xy($pdf, 'Occupation', $column2, 290);
pdf_show_xy($pdf, 'Employment Status', $column2, 275);
pdf_show_xy($pdf, 'Work Phone', $column2, 260);

//Relative/Next of Kin (col 2)
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Home Phone', $column2, 205);
pdf_show_xy($pdf, 'Marital Status', $column2, 190);
pdf_show_xy($pdf, 'Work Phone', $column2, 165);
pdf_show_xy($pdf, 'Employer', $column2, 150);
//End Relative Next of kin (col 2)

//begin user information column 1
pdf_setfont($pdf, $font1, 14); //non-bold font
pdf_show_xy($pdf, $personnal[0],   $infocolumn1, 630);
pdf_show_xy($pdf, $personnal[2],   $infocolumn1, 615);
pdf_show_xy($pdf, $personnal[4],   $infocolumn1, 600);
pdf_show_xy($pdf, $personnal[5],   $infocolumn1, 585);
pdf_show_xy($pdf, $personnal[8],   $infocolumn1, 570);
pdf_show_xy($pdf, $personnal[9],   $infocolumn1, 555);
pdf_show_xy($pdf, $personnal[11],  $infocolumn1, 540);
pdf_show_xy($pdf, $personnal[13],  $infocolumn1, 525);

//begin user information column 2
pdf_show_xy($pdf, $personnal[1],  $infocolumn2, 630);
pdf_show_xy($pdf, $personnal[3],  $infocolumn2, 615);
pdf_show_xy($pdf, $personnal[6],  $infocolumn2, 600);
pdf_show_xy($pdf, $personnal[7],  $infocolumn2, 585);
pdf_show_xy($pdf, $personnal[10], $infocolumn2, 570);
pdf_show_xy($pdf, $personnal[12], $infocolumn2, 555);
pdf_show_xy($pdf, $personnal[14], $infocolumn2, 540);

//begin employment information column 1
pdf_show_xy($pdf, $employment[0],  $infocolumn1, 485);
pdf_show_xy($pdf, $employment[2],  $infocolumn1, 470);
pdf_show_xy($pdf, $employment[4],  $infocolumn1, 455);
pdf_show_xy($pdf, $employment[6],  $infocolumn1, 440);
//begin employment information column 2
pdf_show_xy($pdf, $employment[1], $infocolumn2, 485);
pdf_show_xy($pdf, $employment[3], $infocolumn2, 470);
pdf_show_xy($pdf, $employment[5], $infocolumn2, 455);


//begin physician information column 1
pdf_show_xy($pdf, $physician[0],  $infocolumn1, 400);

//begin physician information column 2
pdf_show_xy($pdf, $physician[1], $infocolumn2, 400);

//begin financial information column 1
pdf_show_xy($pdf, $financial[0],  $infocolumn1, 360);
pdf_show_xy($pdf, $financial[2],  $infocolumn1, 345);
pdf_show_xy($pdf, $financial[4],  $infocolumn1, 320);
pdf_show_xy($pdf, $financial[5],  $infocolumn1, 305);
pdf_show_xy($pdf, $financial[7],  $infocolumn1, 290);
pdf_show_xy($pdf, $financial[9],  $infocolumn1, 275);
pdf_show_xy($pdf, $financial[11], $infocolumn1, 260);
pdf_show_xy($pdf, $financial[13], $infocolumn1, 245);


//begin financial information column 2
pdf_show_xy($pdf, $financial[1],  $infocolumn2, 360);
pdf_show_xy($pdf, $financial[3],  $infocolumn2, 345);
pdf_show_xy($pdf, $financial[6],  $infocolumn2, 320);
pdf_show_xy($pdf, $financial[8],  $infocolumn2, 305);
pdf_show_xy($pdf, $financial[10], $infocolumn2, 275);
pdf_show_xy($pdf, $financial[12], $infocolumn2, 260);
pdf_show_xy($pdf, $financial[14], $infocolumn2, 245);

//begin emergency information column 1
pdf_show_xy($pdf, $emergency[0],  $infocolumn1, 205);
pdf_show_xy($pdf, $emergency[2],  $infocolumn1, 190);
pdf_show_xy($pdf, $emergency[4],  $infocolumn1, 165);
pdf_show_xy($pdf, $emergency[5],  $infocolumn1, 150);
pdf_show_xy($pdf, $emergency[7],  $infocolumn1, 135);
pdf_show_xy($pdf, $emergency[9],  $infocolumn1, 120);
pdf_show_xy($pdf, $emergency[10], $infocolumn1, 105);

//begin emergency information column 2
pdf_show_xy($pdf, $emergency[1],  $infocolumn2, 205);
pdf_show_xy($pdf, $emergency[3],  $infocolumn2, 190);
pdf_show_xy($pdf, $emergency[6],  $infocolumn2, 165);
pdf_show_xy($pdf, $emergency[8],  $infocolumn2, 150);

  // end the document
  pdf_end_page($pdf);
 
    //BEGIN 2ND PAGE OF PDF
  pdf_begin_page($pdf, 8.5*72, 11*72);
 
  pdf_add_bookmark($pdf, ($personnal[1] . ' ' . $personnal[0]), 0, 0);
 
  $font = pdf_findfont($pdf, 'Times-Bold', 'host', 0);//Section Titles
  $font1 = pdf_findfont($pdf, 'Times-Roman', 'host', 0);//User Info
  $font2 = pdf_findfont($pdf, 'Helvetica-Oblique', 'host', 0);//Row Titles

$column1 = 50;
$column2 = 310;
$infocolumn1 = 150;
$infocolumn2 = 410;

$header = 36;

//COMPANY INFORMATION COMPANY INFORMATION
pdf_setfont($pdf, $font, 12);//bold font for company name
pdf_show_xy($pdf, $company, 36, 750);

pdf_setfont($pdf, $font1, 12); //non-bold font
pdf_show_xy($pdf, $today, 450, 750);
pdf_show_xy($pdf, $companyadd, 36, 737);
pdf_show_xy($pdf, $companyphone, 36, 724);

pdf_setfont($pdf, $font, 18);
pdf_show_xy($pdf, 'Patient Pre-Registration Form - Page 2', 185, 705);

//Begin Primary Insurance
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Primary Insurance Information', $header, 680);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Insurance Carrier', $column1, 660);
pdf_show_xy($pdf, 'Name of Insured', $column1, 645);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'if not patient', $column1, 635);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'SSN', $column1, 620);
pdf_show_xy($pdf, 'Subscriber DOB', $column1, 605);
pdf_show_xy($pdf, 'Group Number', $column1, 590);
pdf_show_xy($pdf, 'Group Name', $column1, 575);
pdf_show_xy($pdf, 'Claims Mailing Address', $column1, 560);
pdf_show_xy($pdf, '-', $column1, 545);
pdf_show_xy($pdf, 'City', $column1, 530);
pdf_show_xy($pdf, 'State', $column1, 515);
pdf_show_xy($pdf, 'Zip Code', $column1, 500);
//End Primary Insurance

//Begin Secondary Insurance
pdf_setfont($pdf, $font, 14);
pdf_show_xy($pdf, 'Secondary Insurance Information', $header, 480);

pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Insurance Carrier', $column1, 460);
pdf_show_xy($pdf, 'Name of Insured', $column1, 445);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'if not patient', $column1, 435);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'SSN', $column1, 420);
pdf_show_xy($pdf, 'Subscriber DOB', $column1, 405);
pdf_show_xy($pdf, 'Group Number', $column1, 390);
pdf_show_xy($pdf, 'Group Name', $column1, 375);
pdf_show_xy($pdf, 'Claims Mailing Address', $column1, 360);
pdf_show_xy($pdf, '-', $column1, 345);
pdf_show_xy($pdf, 'City', $column1, 330);
pdf_show_xy($pdf, 'State', $column1, 315);
pdf_show_xy($pdf, 'Zip Code', $column1, 300);
//End Secondary Insurance

//beginning of second column headings

//Begin Primary Insurance (col 2)
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Plan Name', $column2, 660);
pdf_show_xy($pdf, 'Patient Relationship', $column2, 645);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'to insured', $column2, 635);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Insured Sex', $column2, 620);
pdf_show_xy($pdf, 'Policy Number', $column2, 605);
pdf_show_xy($pdf, 'Pre-Cert/Auth Phone', $column2, 590);
pdf_show_xy($pdf, 'Benefits Phone', $column2, 575);
//End Primary Insurance (col 2)

//Begin Secondary Insurance (col 2)
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Plan Name', $column2, 460);
pdf_show_xy($pdf, 'Patient Relationship', $column2, 445);
pdf_setfont($pdf, $font2, 10); //non-bold font
pdf_show_xy($pdf, 'to insured', $column2, 435);
pdf_setfont($pdf, $font2, 12); //non-bold font
pdf_show_xy($pdf, 'Insured Sex', $column2, 420);
pdf_show_xy($pdf, 'Policy Number', $column2, 405);
pdf_show_xy($pdf, 'Pre-Cert/Auth Phone', $column2, 390);
pdf_show_xy($pdf, 'Benefits Phone', $column2, 375);
//End Primary Insurance (col 2)

//begin insurance information column 1
pdf_show_xy($pdf, $insurance[0],  $infocolumn1, 660);
pdf_show_xy($pdf, $insurance[2],  $infocolumn1, 645);
pdf_show_xy($pdf, $insurance[4],  $infocolumn1, 620);
pdf_show_xy($pdf, $insurance[6],  $infocolumn1, 605);
pdf_show_xy($pdf, $insurance[7],  $infocolumn1, 590);
pdf_show_xy($pdf, $insurance[9],  $infocolumn1, 575);
pdf_show_xy($pdf, $insurance[10],  $infocolumn1, 560);
pdf_show_xy($pdf, $insurance[11],  $infocolumn1, 545);
pdf_show_xy($pdf, $insurance[13],  $infocolumn1, 530);
pdf_show_xy($pdf, $insurance[15],  $infocolumn1, 515);
pdf_show_xy($pdf, $insurance[16],  $infocolumn1, 500);

//begin insurance information column 2
pdf_show_xy($pdf, $insurance[1],  $infocolumn2, 660);
pdf_show_xy($pdf, $insurance[3],  $infocolumn2, 645);
pdf_show_xy($pdf, $insurance[5],  $infocolumn2, 620);
pdf_show_xy($pdf, $insurance[8],  $infocolumn2, 605);
pdf_show_xy($pdf, $insurance[12],  $infocolumn2, 590);
pdf_show_xy($pdf, $insurance[14],  $infocolumn2, 575);
//end insurance information column 2

//begin secondary insurance information column 1
pdf_show_xy($pdf, $secondaryinsurance[0],  $infocolumn1, 460);
pdf_show_xy($pdf, $secondaryinsurance[2],  $infocolumn1, 445);
pdf_show_xy($pdf, $secondaryinsurance[4],  $infocolumn1, 420);
pdf_show_xy($pdf, $secondaryinsurance[6],  $infocolumn1, 405);
pdf_show_xy($pdf, $secondaryinsurance[7],  $infocolumn1, 390);
pdf_show_xy($pdf, $secondaryinsurance[9],  $infocolumn1, 375);
pdf_show_xy($pdf, $secondaryinsurance[10],  $infocolumn1, 360);
pdf_show_xy($pdf, $secondaryinsurance[11],  $infocolumn1, 345);
pdf_show_xy($pdf, $secondaryinsurance[13],  $infocolumn1, 330);
pdf_show_xy($pdf, $secondaryinsurance[15],  $infocolumn1, 315);
pdf_show_xy($pdf, $secondaryinsurance[16],  $infocolumn1, 300);

//begin secondary insurance information column 2
pdf_show_xy($pdf, $secondaryinsurance[1],  $infocolumn2, 460);
pdf_show_xy($pdf, $secondaryinsurance[3],  $infocolumn2, 445);
pdf_show_xy($pdf, $secondaryinsurance[5],  $infocolumn2, 420);
pdf_show_xy($pdf, $secondaryinsurance[8],  $infocolumn2, 405);
pdf_show_xy($pdf, $secondaryinsurance[12],  $infocolumn2, 390);
pdf_show_xy($pdf, $secondaryinsurance[14],  $infocolumn2, 375);


  // end the document
  pdf_end_page($pdf);
 
  pdf_close($pdf);

################################################################################
################################################################################
//output to e-mail
//output to e-mail
 
// create the file to be e-mailed
$data = pdf_get_buffer($pdf);
$file = $filename . '.pdf';
$fp = fopen($file, 'w+');

fwrite($fp, $data);
fclose($fp);

require_once('../register/mail/htmlMimeMail.php');

$mail = new htmlMimeMail();

$mail->setFrom("TSJHPre-Registration");

$mail->setSubject('Pre-Registration Form');

$attachment = $mail->getFile($file);

$mail->setText('You have received this automated
mailing from the Texas Spine & Joint Hospital web site.
Please do not respond to this email. This message
contains an attached pdf registration form for patient '.$patient.'.
Thank-You.... Have a good day!');

      $mail->addAttachment($attachment, $file, 'application/pdf');

$mail->send(array('elkinhimer@sbcglobal.net'));

//destroy the file that was e-mailed
unlink($file);

################################################################################
################################################################################
//output to web browser
//output to web browser

header ('Location: https://www.tsjh.org/contact/thanks.html');


// header  ('Content-Type: Application/pdf');
// header  ('Content-Disposition: inline; filemane=$file');
// header  ('Conten-Length: ' . strlen($data));
   
//echo $data;


?>
0
 

Author Comment

by:phillystyle123
ID: 17219043
hey NetExpert -

sorry totally spaced - your code worked great - i was missing a coma somewhere

thanks!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question