Solved

Generate pdf report in New browser window Drupal

Posted on 2011-03-14
6
691 Views
Last Modified: 2012-05-11
Which TCPDF function should I use in order to generate the pdf in a new browser window?
0
Comment
Question by:vivekpv10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 450 total points
ID: 35127887
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 35127966
In my experience, I have found FPDF.org to be a great resource.  I have not used it with Drupal, but I cannot imagine any reason why it would not work.  The class is very easy to use and very fast.  It allows positioning to within about 1/100 inch (good enough for find graphics on business cards).

When I have used it, I have written the PDF file into the server file system and produced a link to the PDF file in the browser window.  It's easy to set target="_blank" or some similar attribute of the <a> tag that points to the PDF file.

HTH, ~Ray
0
 
LVL 5

Author Comment

by:vivekpv10
ID: 35135318
can anyone pls post sample code...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 50 total points
ID: 35137798
I can show you the "Hello World" example.  You can see it in action on my server, here:
http://www.laprbass.com/RAY_fpdf_hello_world.php

HTH, ~Ray
<?php // RAY_fpdf_hello_world.php


// DEMONSTRATE THE BASICS OF FPDF


// BRING IN THE PDF THING
require_once('fpdf16/fpdf.php');

// SYNTHESIZE THE PDF FILE NAME
$pdf_file_link = '/RAY_junk/' . 'temp_pdf_color' . '.pdf';
$pdf_file_name = getcwd()     . $pdf_file_link;

// DO THE HELLO WORLD EXERCISE IN WHITE ON A BLUE BACKGROUND
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->SetFillColor(0,0,255);
$pdf->SetTextColor(255,255,255);
$pdf->Cell(40,10,'Hello World!',0,2,'L', TRUE);

// WRITE THE PDF TO DISK
$pdf->Output($pdf_file_name,'F');

// PRESENT A LINK
echo "<a target=\"my_PDF\" href=\"$pdf_file_link\">PDF</a>\n";

Open in new window

0
 
LVL 5

Author Comment

by:vivekpv10
ID: 35147793
Ok Ray...i will test it...
0
 
LVL 5

Author Closing Comment

by:vivekpv10
ID: 35231885
Thanks....
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SharePoint and CAML query help 4 26
jQuery element reference issue 2 38
Add Rows on a Table 8 50
WordPress:  Reset File Permission after server migration 5 61
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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 the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

739 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