PDF::Core - Core Library for PDF library |
PDF::Core - Core Library for PDF library
use PDF::Core;
$pdf=PDF::Core->new ; $pdf=PDF->new(filename);
$res= $pdf->GetObject($ref);
$name = UnQuoteName($pdfname); $string = UnQuoteString($pdfstring);
$pdfname = QuoteName($name); $pdfhexstring = QuoteHexString($string); $pdfstring = QuoteString($string);
$obj = PDFGetPrimitive (filehandle, \$offset); $line = PDFGetLine (filehandle, \$offset);
The main purpose of the PDF::Core library is to provide the data structure and the constructor for the more general PDF library.
This functions are not part of the class, but perform useful services.
This function processes quoted characters in a PDF-name. PDF-names returned by GetObject are already processed by this function.
Returns a string.
This function extracts the text from PDF-strings and PDF-hexstrings. It will process all quoted characters and remove the enclosing braces.
WARNING: The current version doesn't handle unicode strings properly.
Returns a string.
This function quotes problematic characters in a PDF-name. This function should be used before writing a PDF-name back to a PDF-file.
Returns a string.
This function translates a string into a PDF-hexstring.
Returns a string.
This function translates a string into a PDF-string. Problematic character will be quoted.
WARNING: The current version doesn't handle unicode strings properly.
Returns a string.
This internal function is used while parsing a PDF-file. If you are not writing extentions for this library and are parsing some special parts of the PDF-file, stay away and use GetObject instead.
This function has many quirks and limitations. Check the source for details.
This internal function was used to read a line from a PDF-file. It has many limitations and you should stay away from it, if you don't know what you are doing. Use GetObject or PDFGetPrimitive instead.
This is the constructor of a new PDF object. If the filename is missing, it returns an empty PDF descriptor ( can be filled with $pdf->TargetFile). Otherwise, It acts as the PDF::Parse::TargetFile method.
The available methods are:
This methods returns the PDF-object for reference. The string reference must match the regular expression /^\d+ \d+ R$/, where the first number is the object number, the second number the generation number.
The return value is a PDF-primitive, the type depends on the content of the object:
The values of the hash can be any PDF-primitive, including PDF-arrays and other dictionaries.
This is the most common value returned by GetObject. If the key Stream_Offset exists, the dictionary is followed by stream data, starting at the file offeset indicated by this value.
while ($len =~ m/^\d+ \d+ R$/) {$len = $self->GetObject ($len); }
Example: 22 0 R
Example: /MediaBox
Example: (This is\na string with two \(2\) lines.)
Example: <48 45 4c4C4 F1c>
Example: 611
Example: true
To improve performance GetObject uses an internal cache for objects. Repeated requests for the same objects are not read form the file but satisfied from the cache. With the Variable $PDF::Core::UseObjectCache, the caching mechanism can be turned off.
WARNING
Special care must be taken, when returned objects are modified. If the object contains sub-objects, the sub-objects are not duplicated and all changes affect all other copies of this object. Use your own copy, if you need to modify those values.
Available variables are:
Copyright (c) 1998 - 2000 Antonio Rosella Italy antro@tiscalinet.it, Johannes Blach dw235@yahoo.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The latest version of this library is likely to be available from:
http://www.geocities.com/CapeCanaveral/Hangar/4794/
PDF::Core - Core Library for PDF library |