Solved

Generate pdf report in New browser window Drupal

Posted on 2011-03-14
6
678 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
  • 3
  • 2
6 Comments
 
LVL 27

Accepted Solution

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

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 108

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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)

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now