38
Chapter 3: PDFlib API Reference 21
3.6 Image Functions
PDF_image *PDF_open_JPEG(PDF *p, char *filename)
PDF_image *PDF_open_TIFF(PDF *p, char *filename)
PDF_image *PDF_open_GIF(PDF *p, char *filename)
Open and analyze a raster graphics file in one of the supported file formats.
The returned structure, if not NULL, contains crucial image parameters
such as width and height in pixels and the number of colors used. The
pointer to this structure must be used to embed the image data in a PDF
file.
Restrictions:
>Not all file formats may be supported in a particular PDFlib implemen-
tation due to licensing or technical issues.
>Not all flavors of a supported file format may actually work.
void PDF_close_image(PDF *p, PDF_image *image)
void PDF_close_JPEG(PDF *p, PDF_image *image)
void PDF_close_TIFF(PDF *p, PDF_image *image)
void PDF_close_GIF(PDF *p, PDF_image *image)
Close the supplied image file and free the image structure.
void PDF_place_image(
PDF *p, PDF_image *image, float x, float y, float scale)
Place the supplied image (which must have been retrieved with one of the
PDF_open_*() functions) on the current page. The lower left corner of the
image is placed at (x, y) on the current page and the image is scaled by the
supplied scaling factor.
void PDF_place_inline_image(
PDF *p, PDF_image *image, float x, float y, float scale)
Same as PDF_place_image(), but the image data is placed inline in the PDF
file. This should only be used in rare cases.
void PDF_put_image(PDF *p, PDF_image *image)
Put the image data in the PDF without ÈexecutingÇ it, i.e. the image data is
only parked in the file for later reference.
void PDF_execute_image(
PDF *p, PDF_image *image, float x, float y, float scale)
ÈExecuteÇ image data (place at (x, y) and scale) it. The image data must
previously have been put into the PDF file with PDF_put_image().
The put/execute technique is useful for re-using image data on several
places in a PDF file, e.g. a logo appearing on each page.
40
22
Chapter 3: PDFlib API Reference
The image structure may only be closed after the last call to
PDF_execute_image().
void PDF_data_source_from_buf(
PDF *p, PDF_data_source *src, byte *buffer, long len)
Utility routine for converting a memory buffer to a PDFlib data source. This
may only be useful for internal and testing purposes.
3.7 Hypertext Functions
In this section, the term ÈhypertextÇ is used to denote features which do
not directly affect the printed layout, such as bookmarks and page transi-
tions.
void PDF_add_outline(PDF *p, char *text)
Add a PDF bookmark with the supplied text that points to the current page.
The text must be encoded with PDFDocEncoding.
Restriction:
> Currently bookmarks cannot be nested.
void PDF_set_transition(PDF *p, PDF_transition t)
Set the page transition effect for the current page. The following transition
types are supported:
void PDF_set_duration(PDF *p, float time)
Set the page display duration (in seconds) for self-animated PDFs.
3.8 Convenience Stuff
PDF_pagesize a0, a1, a2, a3, a4, a5, a6, b5, letter, legal, ledger, p11x17;
These structures hold page and width values for the most common page
formats which may be used in calls to PDF_begin_page().
trans_split
Two lines sweeping across the screen reveal the page.
trans_blinds
Multiple lines sweeping across the screen reveal the page.
trans_box
A box reveals the page.
trans_wipe
A single line sweeping across the screen reveals the page.
trans_dissolve
The old page dissolves to reveal the page.
trans_glitter
The dissolve effect moves from one screen edge to another.
trans_replace
The old page is simply replaced by the new page (default).
19
Chapter 3: PDFlib API Reference 23
3.9 Optimization Techniques
Re-using image data. Although the respective library functions are docu-
mented in Section 3.6, ÈImage FunctionsÇ, it might be worth pointing out
that PDFlib supports an important PDF optimization technique for using
repeated raster images.
Consider a layout with a constant logo or background on several pages.
In this situation it is possible to include the image data only once in the PDF
and generate only a reference on each of the pages where the graphic is
used. Simply open the image file, include the image data with
PDF_put_image() in the PDF, and call PDF_execute_image() each time you
want to place the logo or background on a particular page. Depending on
the imageÕs size and the number of occurences, this technique may prove as
a big space saver.
3.10 General Restrictions
Functional restrictions concerning PDFlib output:
>PDFlib-generated files are not optimized (in the sense of linearization
necessary for page-at-a-time download).
>PDFlib is currently unable to produce streaming output.
C# Word - Word Conversion in C#.NET Word documents in .NET class applications independently, without using other external third-party dependencies like Adobe Acrobat. Word to PDF Conversion.
how to delete text in pdf converter; how to delete text from a pdf document
40
24
Chapter 4: Supplied Library Clients
4Supplied Library Clients
This section briefly describes the sample library clients supplied with the
PDFlib distribution. These clients serve two purposes: they may be useful
programs in themselves, and they provide sample code for the application
programmer looking forward to using the PDFlib API.
hello [filename]
This is the ÈHello, World!Ç sample discussed in Section 2.1, ÈA Programming
ClassicÇ.
If a file name is supplied on the command line, the named file will be
generated. Otherwise, the file name hello.pdf is used.
pdfdemo [filename]
This is a sample PDFlib application which employs many features of PDFlib
such as text and graphics output, embedding, rotating and scaling of sever-
al raster images. As well as supplying sample C code, pdfdemo serves as a
test bed for the library.
If a fil name is supplied on the command line, the named file will be
generated. Otherwise, the file name demo.pdf is used.
pdfclock [-c pagecount] -o filename
Generate a PDF with an analog clock face showing the current time. filena-
me is the name of the PDF file to be generated. If supplied on the command
line, pagecount specifies the number of pages to be generated. Pages are
generated with a delay of approximately one second. Since the PDF output
specifies a page advance delay with a wipe page transition, the output
somehow resembles a real analog clock. Try it!
pdfgraph -b -o filename datafile
An interpreter for a mini-language describing vector-oriented graphics.
Simple lines and color settings can be used to generate nice little demos or
real graphs. filename is the name of the PDF file to be generated, datafile
contains the drawing instructions. The -b option specifies binary PDF out-
put.
text2pdf [options] [textfile]
-b binary mode (default: ASCII)
-f fontname name of font to use
-h height page height in points
-m margin margin size in points
-s size font size
-o filename PDF output file name
-w width page width in points
14
Chapter 4: Supplied Library Clients 25
-I path path to AFM and font directory
Convert the text in the supplied text file to PDF. Several aspects of the gen-
erated PDF can be controlled via command line options.
imagepdf [options] imagefile(s)
-a ASCII mode (default: binary)
-c print caption
-o <file> output file
Convert one or more graphics file(s) to PDF. Each file is placed on a separate
page of appropriate size. For easy reference a bookmark with the file name
points to each page.
Note that the range of supported graphics file formats depends on your
particular PDFlib installation. Supported formats may include JPEG, GIF,
and TIFF.
C# Excel - Excel Conversion & Rendering in C#.NET Excel documents in .NET class applications independently, without using other external third-party dependencies like Adobe Acrobat. Excel to PDF Conversion.
acrobat remove text from pdf; how to delete text from pdf reader
36
26
Chapter 5: Environment Bindings
5Environment Bindings
PDFlib may be used in different environments, e.g., language bindings, Web
integration techniques, scripting languages. Several bindings are support-
ed in the distributed PDFlib package. Some hints related to these bindings
are given in this section.
5.1 Common Gateway Interface (CGI)
Due to the general nature of CGI, no special action must be taken in order to
use PDFlib within a CGI environment. The cgi-bin subdirectory contains a
very small example for integrating PDFlib programs in a Web server envi-
ronment. The MIME type for PDF files is as follows:
application/pdf
The clock.cgi sample generates a temporary PDF file using the pdfclock
demo client and sends the PDF data to the Web browser using the CGI inter-
face. After sending the data the temporary file is deleted:
#!/bin/sh
TMP=/var/tmp/clock.$$.pdf
echo Content-type: application/pdf
echo
pdfclock -o $TMP
cat $TMP
rm $TMP
exit 0
Of course, the necessary HTTP header(s) may also be generated directly by a
PDFlib application. The above CGI shell script is mainly for instructional
purposes.
5.2 Tcl/Tk Binding
There is currently some work underway to support PDF generation from
within Tcl/Tk scripts. Although the distribution currently doesnÕt support
it, Tcl support will at some point in future be a standard feature in PDFlib.
rjs@ifconnection.de is working on this topic.
5.3 Other Bindings
Several bindings to other environments are either considered or already in
the works although not currently included in the distribution:
> PDFlib as a Windows DLL
4
Chapter 5: Environment Bindings 27
>PDFlib as an ISAPI module for use with Microsoft Internet Information
Server
>PDFlib as a module for use with Python
27
28
Chapter 6: The PDFlib License
6The PDFlib License
PDFlib is subject to the ÈALADDIN FREE PUBLIC LICENSEÇ.
1
The complete
text of the license agreement can be found in the file LICENSE. In short and
non-legal terms:
> You may use and distribute PDFlib non-commercially.
> You may develop free software with PDFlib.
> You may NOT sell any software based on PDFlib without prior written
permission of the author.
> If you write PDFlib programs and sell them, you need a commercial
PDFlib license.
Note that this is only a 10-second-description which is not legally
binding. Only the text in the LICENSE file is considered to completely
describe the licensing conditions. Please contact the author for details on
using PDFlib commercially:
Consulting & Publishing
Thomas Merz
Tal 40
80331 MŸnchen, Germany
http://www.ifconnection.de/~tm
tm@muc.de
fax +49/89/29 16 46 86
1. The license text was devised by L. Peter Deutsch of Aladdin Enterprises (Menlo Park, CA). Thanks Peter
for making available the text!
27
Chapter 7: References 29
7References
Although this manual is intended to be self-contained with respect to
PDFlib programming, it is highly recommended to obtain a copy of the PDF
specification for a deeper understanding and more detailed information:
[1] Portable Document Format Reference Manual, Version 1.2
Available from
http://www.adobe.com/supportservice/devrelations/PDFs/TN/PDFSPEC.PDF
[2] The following book by the author of PDFlib is available in English and
German editions. It describes all aspects of integrating Acrobat in the
WWW:
English edition:
Thomas Merz: Web Publishing with Acrobat/
PDF. Springer-Verlag Heidelberg Berlin New
York 1998
ISBN 3-540-63762-1
orders@springer.de
German edition:
Thomas Merz: Mit Acrobat ins World Wide
Web.
Effiziente Erstellung von PDF-Dateien und
ihre Einbindung ins Web.
ISBN 3-9804943-1-4, 1997
Thomas Merz Verlag
80331 MŸnchen, Tal 40
Fax +49/89/29 16 46 86
http://www.ifconnection.de/~tm
12
30
Chapter 8: Revision History
8Revision History
Version information on PDFlib itself can be found in the distribution. This
chapter documents changes to the PDFlib Reference Manual (this docu-
ment).
22 September 1997
> First public release of PDFlib (version 0.4) and this manual.
25 February 1998
> Slightly expanded the manual to cover PDFlib version 0.5.
And now
for a little commercial...
Documents you may be interested
Documents you may be interested