473,786 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create PDFs from JPGs ?

All,
Does anyone know of a script that already exists that would allow me to pass
in the name of a JPG or GIF and spit out a PDF ?

Just checking around before I buckle down and write one.
Thanks.
Jul 17 '05 #1
2 3228
StinkFinger wrote:
All,
Does anyone know of a script that already exists that would allow me to pass
in the name of a JPG or GIF and spit out a PDF ?

Just checking around before I buckle down and write one.
Thanks.


Not as such, but php-pdf (http://www.ros.co.nz/pdf) can happily build a
pdf page with jpegs inserted. It's simple to set up as well.
Jul 17 '05 #2
maybe this helps you :

<?php
# $Id: image.php,v 1.9.2.2 2003/12/17 15:38:01 tm Exp $

/* This is where font/image/PDF input files live. Adjust as necessary. */
$searchpath = "../data";

$p = PDF_new(); /* create a new PDFlib object */

PDF_set_paramet er($p, "SearchPath ", $searchpath);

/* open new PDF file; insert a file name to create the PDF on disk */
if (PDF_open_file( $p, "") == 0) {
die("Error: " . PDF_get_errmsg( $p));
}

/* This line is required to avoid problems on Japanese systems */
PDF_set_paramet er($p, "hypertextencod ing", "winansi");

PDF_set_info($p , "Creator", "image.php" );
PDF_set_info($p , "Author", "Rainer Schaaf");
PDF_set_info($p , "Title", "image sample (PHP)");

$imagefile = "test.jpg";

$image = PDF_load_image( $p, "auto", $imagefile, "");
if (!$image) {
die("Error: " . PDF_get_errmsg( $p));
}

/* dummy page size, will be adjusted by PDF_fit_image() */
PDF_begin_page( $p, 20, 20);
PDF_fit_image($ p, $image, 0, 0, "adjustpage ");
PDF_close_image ($p, $image);
PDF_end_page($p ); /* close page */

PDF_close($p); /* close PDF document */

$buf = PDF_get_buffer( $p);
$len = strlen($buf);

header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=image. pdf");
print $buf;

PDF_delete($p); /* delete the PDFlib object */
?>

"StinkFinge r" <st****@pinky.c om> schreef in bericht
news:10******** *****@corp.supe rnews.com...
All,
Does anyone know of a script that already exists that would allow me to pass in the name of a JPG or GIF and spit out a PDF ?

Just checking around before I buckle down and write one.
Thanks.

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2307
by: Dave Karmens | last post by:
I fire the following code on Index Server (different obj) and it returns a PDFs no problem, but when I change the object to use the MSSearch for Site Server I don't get any PDFs. Anything in the code that would cause this? I can see the PDFs getting crawled in Site Server, but when I try and search I don't get any pdfs. :< <%
14
1956
by: BlueDolphin | last post by:
Hello all. I'm looking for some opinions on using snapshot files or ..pdf for some reports. We are in the initial stages of creating some reports in access that will be pulled online through Cold Fusion. In the past, I have simply created reporting tables with routines that populated the tables overnight. I then use Cold Fusion to output the info online as I wanted it to look. I am in a shop now that wants to use either .pdfs or...
1
1407
by: Ecohouse | last post by:
I have created a MS Access Project linking to a SQL database. I created a table that I want to hold jpgs in. The actual field I created is a datatype of image. I created a form in Access. When I click on the picture frame I right click to insert an object. I then find the jpg and insert it. But the picture doesn't show on the form. When I look at the table that field just says Package. So I wanted to know what I need to do to get...
3
2388
by: Null | last post by:
Hello -- I am looking for a way to dynamically generate PDF documents - combining Crystal Reports and data driven "fields". For example, I have a template that's essentially a summary document and I would like to populate certain fields with client names and account data. Also, I would like to make a "master" PDF that contains all the PDF summaries in one document -- and use bookmarks if possible.
3
1958
by: Mike Kingscott | last post by:
Hi there, I'm writing an app in which a punter buys some PDFs online. After purchasing said PDFs, they will be given a token (bless them Guids) to go to a download .ASPX page from which they can download the PDFs. I'm planning to use Forms Authentication to protect the .ASPX page which gives them the list of PDFs they can download (driven by the token, which will be their order number or similar). The page will also only allow 10...
7
2790
by: C G | last post by:
Dear All, What's the best way to store jpgs in postgresql to use in a web page? I tried to use large objects, but how would you extract them from a table to be viewed in a web-page without having to write them to a scratch file somewhere first? Thanks
5
1589
by: monomaniac21 | last post by:
Hi I have uploaded a pdf file into my db and am trying to display it again here is the code i have used (at the moment it is just displaying the binary file's code as text in a html page: <?php session_start(); include("connection.php"); $query = "SELECT resource, resource_name FROM tblresources WHERE id = '3' ";
3
3286
by: Kladrian | last post by:
Hi guys, I have a lot of JPGs and I need to write a c# code to generate a MPEG file with those images. I don't have to change compression of images. This will be an automatic code that every day will starts .. so every thing MUST BE without any human action.
2
1304
by: VivekR | last post by:
Hi All Please help me out with this thing in javascript. I am dumb in the world of JS/Html/... I have a url, say www.someurl.com. It has a list of jpgs that can accessed as www.something.com/one.jpg or www..../two.jpg etc. Now i need to get the list of the jpgs and then display it on a web page one by one, triggered by a timer. I have to do this using javascript.
0
9650
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.