Skip to content
Loading

The City

Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.

What?

Chania is a city on the island of Crete.

Where?

Crete is a Greek island in the Mediterranean Sea.

How?

You can reach Chania airport from all over Europe.

Resize the browser window to see how the content respond to the resizing.

+2
  • Ravishankar N
    +1
    i Krishna vala ,
    Download mPDF from the below link
    https://github.com/mpdf/mpdf
    mPDF is a PHP library which generates PDF files from UTF-8 encoded HTML.
    Use this below piece of code to convert HTML to pdf
    1. require_once __DIR__ . '/vendor/autoload.php';  
    2. $mpdf = new \Mpdf\Mpdf();  
    3. $mpdf->WriteHTML('

      Hello world!

      '
      );  
    4. $mpdf->Output();  
    +1
  • +1
    You can try using the Cloud PHP Conversion services From LEADTOOLS that support converting different file formats including HTML into PDF (and other document formats).
    You can find more information here:
    https://services.leadtools.com/documentation/tutorials
    https://services.leadtools.com/documentation/tutorials/php-conversion-tutorial

    For example, the following code shows how you can pass your HTML file into the service and convert it into PDF format using LEADTOOLS Cloud Services:
    1. $servicesBaseUrl = "https://azure.leadtools.com/api/";  
    2. //The first page in the file to mark for processing  
    3. $firstPage = 1;  
    4. //Sending a value of -1 will indicate to the services that the rest of the pages in the file should be processed.  
    5. $lastPage = -1;  
    6. //Enum corresponding to the output format for the file. For the purposes of this script, we will be converting to PDF.  
    7. $fileFormat = FormatsEnum::Pdf;  
    8.   
    9. //We will be uploading the file via a URl.  Files can also be passed by adding a PostFile to the request.  Only 1 file will be accepted per request.  
    10. //The services will use the following priority when determining what a request is trying to do GUID > URL > Request Body Content  
    11. $fileURL                = 'https://MyWebSute.com/Files/Source.html';  
    12. $baseConverionURL       = '%sConversion/Convert?firstPage=%s&lastPage=%s&format=%s&fileurl=%s';  
    13. $formattedConversionURL = sprintf($baseConverionURL, $servicesBaseUrl, $firstPage, $lastPage, $fileFormat, $fileURL);  
    14.   
    15. //Generate the CURL options to be used  
    16. $conversionRequestOptions = GeneratePostOptions($formattedConversionURL);  
    17.   
    18. $request = curl_init();  
    19. curl_setopt_array($request, $conversionRequestOptions); //Set the request URL  
    20.   
    21. if (!$guid = curl_exec($request)) {  
    22.     echo "There was an error processing the request. \n\r";  
    23.     echo $guid;  
    24.     exit;  
    25. }  
    26. curl_close($request); //Close the request  
    27.   
    28. echo "Unique ID returned by the services: $guid \n\r";  
    29.   
    30. echo "Querying Results...\n\r";  
    31. $baseQueryURL        = '%sQuery?id=%s';  
    32. $formattedQueryURL   = sprintf($baseQueryURL, $servicesBaseUrl, $guid);  
    33. $queryRequestOptions = GeneratePostOptions($formattedQueryURL);  
    34.   
    35. while (true) { //Poll the services to determine if the request has finished processing.  
    36.     $request = curl_init();  
    37.     curl_setopt_array($request, $queryRequestOptions); //Set the request URL  
    38.     if (!$results = curl_exec($request)) {  
    39.         echo "There was an error querying the services \n\r";  
    40.         echo $results;  
    41.         curl_close($request);  
    42.         exit;  
    43.     }  
    44.     curl_close($request);  
    45.     $decodedResponse = json_decode($results);  
    46.     $fileStatus      = $decodedResponse->{'FileStatus'};  
    47.   
    48.     if ($fileStatus != 100 && $fileStatus != 123) {  
    49.         //The file has finished processing  
    50.         break;  
    51.     }  
    52.     sleep(5); //If the file hasn't finished processing, we will wait 5 seconds before checking again.  
    53. }  
    54.   
    55. echo "File finished processing with file status: " . $fileStatus . "\n\r";  
    56.   
    57.   
    58. //The file did not process successfully.  Refer to our documentation for the full list of File Statuses and their associated meanings.  
    59. if ($fileStatus != 200) {  
    60.     exit;  
    61. }  
    62.   
    63. echo "Results: \n\r";  
    64. //Decode and parse the JSON results.  
    65. $jsonArray = $decodedResponse->{'RequestData'};  
    66. foreach ($jsonArray as $serviceResults) {  
    67.     echo "Service Type: " . $serviceResults->{'ServiceType'} . "\n\r";  
    68.     echo "URL List: \n\r";  
    69.     foreach ($serviceResults->{'urls'} as $url) {  
    70.         echo $url . "\n\r";  
    71.     }  
    72. } 
     
    +1
  • +1
    here is the simple jQuery code for your problem:
     
    1. "text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">  
    2. "text/javascript">  
    3.     $("#your_button_id").live("click", function () {  
    4.       var html = "";  
    5.      $('link').each(function () { 
    6.       if ($(this).attr('rel').indexOf('stylesheet') != -1) {
    7.            html += ' + $(this).attr("href") + '" />';  
    8.             }  
    9.         });  
    10.  html += ''+$("#your_div_id").html()+'';  
    11.         var w = window.open("", "print");  
    12.         if (w) { w.document.write(html); w.document.close() }  
    13.     });  
    14.   
     
    +1