Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Generate pdf report in New browser window Drupal

Posted on 2011-03-14
6
Medium Priority
?
705 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 1800 total points
ID: 35127887
0
 
LVL 111

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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 200 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

705 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