Jump to content

ttsprez

Members
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ttsprez

  • Rank
    Member
  1. ttsprez

    Pdf to html Converter needed

    unfortunately, I'm too far into my process using the dompdf library that I just can't see starting all over again with something else.... Unless I could find something that would place data straight into a pdf as opposed to creating an html or another kind of template and then rendering a pdf. Taking data straight to a pdf field would be great, but I understand to do that you have to know what the pdf field names are and how to do that is something I'm not familiar with.
  2. ttsprez

    Query Statement Help

    yes, and it gives me the same statement with the $refcode. Okay so, I forgot I have had the "die($query);", but just removed it and now all it gives me a repetitive " : " with no name or data info as the code is requesting. as to the second part of your statement pertaining to 'prepared statements' I will have to research that and implement it. If it makes this query function in a more proper manner than it would seem that it needs to be done.
  3. ttsprez

    Query Statement Help

    yes, and it gives me the same statement with the $refcode. Okay so, I forgot I have had the "die($query);", but just removed it and now all it gives me a repetitive " : " with no name or data info as the code is requesting.
  4. ttsprez

    Query Statement Help

    @Mac_gyver Thanks for pointing that out. I'm new to this and learning as I go... but I change the method="get" to method="post" and I'm still getting the same message in the browser.
  5. ttsprez

    Query Statement Help

    I'm having an issue with a query statement pulling info: This link carries customers to a "document gateway" where they are required to enter a reference code. https://pdforms.losttitleconnection.net/TX Title App Gate.php Use this Reference Code for test purpose: QKEX49MKDE On submit the PHP code is to take the reference code from the Post function of the gateway form and convert it to a variable $refcode This variable is then used in the query statement to pull 'name' and 'data' from the form_data table and use it to replace form field names with data in an html template. Then it is to present the new form in a pdf format to the browser for download or printing. I'm using the dompdf library to do this, but for now, am only using a short query test code to ensure I'm pulling the correct data by having the code display results. Currently, on submit, the browser is presenting the following: SELECT name,data FROM thetitl1_livesite754.form_data WHERE form_id IN(SELECT id FROM thetitl1_livesite754.forms WHERE reference_code = '') The following is the code as it appears in my PHP file. Help to get this figured out would be greatly appreciated. <?php //create a connection to MySQL require 'dogs.php'; //query for reference_code from 'forms' table $refcode = filter_input(INPUT_POST,'reference_code'); $mysqli = new mysqli($server, $username, $password, $dbase); $query = "SELECT name,data FROM thetitl1_livesite754.form_data WHERE form_id IN(SELECT id FROM thetitl1_livesite754.forms WHERE reference_code = '" . $refcode . "')"; die($query); $results = $mysqli->query($query); $new_form = file_get_contents("TX_Title_App.html"); //Replaces form_fields in html temp with "data" if ($results) { //below is the line referenced in error message above while ($row = mysqli_fetch_fields($results)) { echo $row["name"] . ":" . $row["data"] . "<br>"; $new_form = str_replace($row["name"], $row["data"], $new_form); } } ?>
  6. ttsprez

    Pdf to html Converter needed

    still working on debugging the MySQL query statement to ensure it's returning the info the way I need it, but getting there. This issue was just something that came up as another issue that needed to be corrected.
  7. ttsprez

    Pdf to html Converter needed

    no, sorry if I confused you... I have pdf's that need to go to html, then be filled by dompdf, and then shown to the customer as downloadable/printable pdf. My problem now is that the pdf's I've converted are not printing in an actual 8.5 x 11 size for some reason. It seems like the way they were converted has something to do with it. Danm Free Online Converters! LOL
  8. ttsprez

    Pdf to html Converter needed

    So I can give you a full understanding of what I'm doing... My customers submit info via a form page. On submit the info is passed to the database. When payment is processed the info is then filled into the html temp and then presented back to them as a flattened pdf for download or printing. So taking the original pdf and converting it to a jpeg, then open a new word doc that I can then use the jpeg as a background with text boxes holding the form_field names to be replaced with the customer data, that I can then save as an html. I think that will work for what I need. Compared to what I have now, this would make things much easier and far less html code for the dompdf to process when figuring out which items need to be changed. What I have now has absolute positions for every piece of text on the page. Thanks again for sparking the noggin.
  9. ttsprez

    Pdf to html Converter needed

    Hey @requinix Thanks for the suggestion, but don't know if that would work as I need to fill the form with MySQL data after the conversion. I'm using the PHP dompdf library to do this and it needs an html doc to be loaded before it renders. Yet not that I think about it I could create jpegs of each and then absolute position each field name into an html with the jpeg as a background. Does that sound right? Thanks for sparking the epiphany... I'll try it and tell you how it goes for the sake of others having this issue.
  10. ttsprez

    Pdf to html Converter needed

    So I've done a search for pdf to html converters and there are plenty of free online options. The only problem is that they don't convert the pdf to html in an actual 8.5 x11 size, so that when you go to print or use them to be filled by code and then printed, they are to small. Now, some would say, simply resize the html file, but the issue there is when created it actually consists of two files. One an html file with absolute position values for all your text and the second as a jpeg for any backgrounds, frames or images. You can adjust the size of the background, borders and images, but then that would also mean you'd have to go line for line in the html to adjust the absolute positions of all the text. So my question would be, is there a converter that would create an html file in the actual 8.5 x 11 size that anyone knows of? And don't say, Acrobat, cause their conversion doesn't even come close to looking like the original document. Any insight on this matter would be greatly appreciated.
  11. ttsprez

    Help with DOMpdf

    isn't that what this is: $options = new Options(); $options->set('isPhpEnabled','true'); or is this what is missing: use Dompdf\Options; This is the snippet of code dealing with this: // reference the Dompdf namespace require_once '/home1/thetitl1/public_html/pdforms/lib/dompdf/autoload.inc.php'; $dompdf = new Dompdf\Dompdf(); $options = new Dompdf\Options(); $options = new Options(options); $options->set('isPhpEnabled','true'); $new_form = file_get_contents("TX_Title_App.html"); $dompdf = new Dompdf($options); $dompdf->loadHtml($new_form);
  12. ttsprez

    Help with DOMpdf

    so I put the "}" at the end... if ($result = mysqli_query($conn, $query)) { while ($row = mysqli_fetch_assoc($result)) { $new_form = str_replace($row["name"], $row["data"], $new_form); } } and got this: Fatal error: Uncaught Error: Class 'Options' not found in /home1/thetitl1/public_html/pdforms/TX Title App.php:25 Stack trace: #0 {main} thrown in /home1/thetitl1/public_html/pdforms/TX Title App.php on line 25 This is line 21 to 24 and nothing on line 25: // reference the Dompdf namespace require_once '/home1/thetitl1/public_html/pdforms/lib/dompdf/autoload.inc.php'; $dompdf = new Dompdf\Dompdf(); $options = new Options(); $options->set('isPhpEnabled','true');
  13. ttsprez

    Help with DOMpdf

    yeah, was getting to that and got sidetracked, then somehow posted the thread before I was able to add the code... think I've work out most of the problems but still getting Parse error: syntax error, unexpected end of file in /home1/thetitl1/public_html/pdforms/TX Title App.php on line 64 here goes the code. As for the car, I'd have to look at them...LOL <?php //create a connection to MySQL require 'dogs.php'; $servername = "x"; $username = "x"; $password = "x"; $dbname = "x"; $conn = mysqli_connect($servername,$username,$password,$dbname); // Create connection $db = new mysqli($servername, $username, $password, $database); // Check for errors if($db->connect_errno){ echo $db->connect_error; } //query for reference_code from 'forms' table $refcode = filter_input(INPUT_POST, 'reference_code'); // reference the Dompdf namespace require_once '/home1/thetitl1/public_html/pdforms/lib/dompdf/autoload.inc.php'; $dompdf = new Dompdf\Dompdf(); $options = new Options(); $options->set('isPhpEnabled','true'); $new_form = file_get_contents("TX_Title_App.html"); $dompdf = new Dompdf($options); $dompdf->loadHtml($new_form); // Execute query $query = mysqli_query($conn,("SELECT * FROM thetitl1_livesite754.form_data WHERE form_id IN SELECT id FROM thetitl1_livesite754.forms WHERE reference_code ='$refcode'")); //Replaces form_fields in html temp with "data" if ($result = mysqli_query($conn, $query)) { while ($row = mysqli_fetch_assoc($result)) { $new_form = str_replace($row["name"], $row["data"], $new_form); } // Always check for errors if($db->errno){ echo $db->error; } // (Optional) Setup the paper size and orientation $dompdf->setPaper(‘A4’, ‘portrait’); // Render the HTML as PDF $dompdf->render(); // Output the generated PDF to Browser $dompdf->stream(); // Save to file $output= $dompdf->output(); file_put_contents('TXTitleApp.pdf', $output); /* free result set */ mysqli_free_result($result); /* close connection */ mysqli_close($conn); ?>
  14. ttsprez

    Help with DOMpdf

    I'm new to PHP but learning... so please bear with me. I have an HTML page that contains a link to a PHP file that is supposed to generate a pdf using an HTML template and MySQL data so that the customer gets a pre-prepared pdf document for download. I've been working on getting the code put together using NetBeans and with help from a very generous coach/angel, which has helped a lot. But I'd like to get other eyes on this for assistance in an effort to get this completed. I believe I am 90% done, just need a more trained eye to tell me what I'm doing wrong and how to get it fixed. I have put the error messages I'm receiving in the // comments and will color them in blue text for clarity. Any help I can get on this would be greatly appreciated. Also, in advance, to those nay-sayers who may happen to come along, read this and have the urge to critique without providing real help with their responses, please don't waste the time. I will not respond and if allowed, will delete it. By posting my issue, I know I'm not just looking for answers for me, but also, providing answers to those who come after me in search of the same.
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.