Giter Club home page Giter Club logo

zendpdf's Introduction

ZendPdf component

Master: Build Status

ABANDONED

This package is no longer maintained. We recommend TCPDF as a replacement.

Installation

Run the command:

composer require "zendframework/zendpdf": "2.0.*@dev"

At that point, follow the instructions in the documentation folder for actual usage of the component. (Documentation is forthcoming.)

zendpdf's People

Contributors

akrabat avatar b-durand avatar danez avatar dasprid avatar delboy1978uk avatar dermario avatar maks3w avatar marc-mabe avatar mweimerskirch avatar ocramius avatar pawka avatar prolic avatar psliwa avatar ralphschindler avatar royopa avatar sasezaki avatar slamdunk avatar thomasweidner avatar weierophinney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zendpdf's Issues

Acrobat 6 & 7 support

Hi,

First of all, thanks for working on this new version of ZendPdf. I'm currently using ZendPdf to manipulate pdf's metadatas and it's perfectly working with all documents until version 1.4.
However, as PDF versions 1.5 (Acrobat 6) and version 1.7 (Acrobat 7) aren't yet supported, I can't change metadatas on documents generated with these versions.

As google unfortunately only suggested me commercial tools to deal with that task (such as SetaPDF), I was wondering if there was a roadmap to implement Acrobat 6 and Acrobat 7 support in ZendPdf or if you knew any Open Source Php Class including this feature ?

Thanks for your help !

Not properly encoded

I have some problems with characters like '€' in PDF form fields. It is shown in the PDF as a circle if I use setTextField().
However the same text is displayed correctly, if I use drawText().

Performance issue on ZendPdf\Resource\Image\Png with Alpha filter

Hi,

I encounter very serious performance trouble with this file : https://github.com/zendframework/ZendPdf/blob/master/library/ZendPdf/Resource/Image/Png.php#L233

            case self::PNG_CHANNEL_RGB_ALPHA:
                /*
                 * To decode PNG's with alpha data we must create two images from one. One image will contain the RGB data
                 * the other will contain the Gray transparency overlay data. The former will become the object data and the latter
                 * will become the Shadow Mask (SMask).
                 */
[…]
                //Iterate every pixel and copy out rgb data and alpha channel (this will be slow)
                for($pixel = 0, $pixelcount = ($width * $height); $pixel < $pixelcount; $pixel++) {
                    $imageDataTmp .= $pngDataRawDecoded[($pixel*4)+0] . $pngDataRawDecoded[($pixel*4)+1] . $pngDataRawDecoded[($pixel*4)+2];
                    $smaskData .= $pngDataRawDecoded[($pixel*4)+3];
                }

I found two mentions on the great internet:

In the first article there is a mention of parsers being recoded. 6 years later and no trace of that change. Is there any plan on this bug?

See ya. Thanks.

Problem with fillcolor in a style class

use \ZendPdf\Style as Style;

class MyStyleText extends Style
{

  public function __construct()
  {
      $this->setFillColor(new \ZendPdf\Color\Rgb(192, 192, 192));
      $sPath = getcwd()."/data/fonts/arial.ttf";
      $this->setFont(\ZendPdf\Font::fontWithPath($sPath), 20);
  }
 }

Reports the error:

Catchable fatal error: Argument 1 passed to ZendPdf\Style::setFillColor() must be an instance of ZendPdf\Color, instance of ZendPdf\Color\Rgb given, called in C:\wamp\www\zf2b5\ZendSkeletonApplication\module\Luach\src\luach\Model\styles\MyStyleText.php on line 13 and defined in C:\wamp\www\zf2b5\ZendSkeletonApplication\vendor\zendframework\ZendPdf\library\ZendPdf\Style.php on line 103

Fatal error in ZendPdf\Page

Condition in ZendPdf\Page on line 825 can throw fatal error in cases where
BaseFont is not an object.

        if ($fontDictionary->BaseFont->value != $fontName) {
            continue;
        }

I got en error when converting ps file to pdf and then tried to get fonts from it.

Composer constraint should have an upper bound

Current releases of the library are advocating compatibility with all future versions of zendframework/zend-stdlib (which may be broken already, as version 3 contained a bunch of BC breaks) and of zendframework/zend-memory.
Bound constraints should be used instead

Exception when the PDF file have HSamples dictionary definition

Hi,

When the function StreamObject::_extractDictionaryData is called an excpetion is handle Undefined property: \ZendPdf\InternalType\ArrayObject::$value
This bug comes to try get a value on an array ( line 114 ).

$paramKey = HSample;
$this->_dictionary->DecodeParms->$paramKey->value

So here the code is wrong because it trying to get ->value property on an array.

Regards,
Boris.

Dump of the real pdf structure

$this(ZendPdf\InternalType\StreamObject)
    |-[-] _dictionary(ZendPdf\InternalType\DictionaryObject)
    |  |-[-] _items[12]                       
    |  |  |-[+] BitsPerComponent(ZendPdf\InternalType\NumericObject)
    |  |  |-[+] ColorSpace(ZendPdf\InternalType\NameObject)
    |  |  |-[-] DecodeParms(ZendPdf\InternalType\DictionaryObject)
    |  |  |  |-[-] _items[8]                        
    |  |  |  |  |-[+] Blend(ZendPdf\InternalType\NumericObject)
    |  |  |  |  |-[+] ColorTransform(ZendPdf\InternalType\NumericObject)
    |  |  |  |  |-[+] Colors(ZendPdf\InternalType\NumericObject)
    |  |  |  |  |-[+] Columns(ZendPdf\InternalType\NumericObject)
    |  |  |  |  |-[-] HSamples(ZendPdf\InternalType\ArrayObject)
    |  |  |  |  |  |-[+] items(ArrayObject)
    |  |  |  |  |  `-     *ZendPdf\InternalType\AbstractTypeObject*_parentObject null

Drawing bezier curves

Hi,

I'm not sure if this repo is now mothballed... however I'm trying to work out if ZendPDF can draw bezier curves. The code alludes to the fact that it uses them, but I cannot find any methods which draw them.

Any help would be really appreciated!
Thanks
Ben

Can't find any documentaion

Hi,

I can't find any documentaion on how to use ZendPDF.

There are nothin on http://framework.zend.com/ and in README.md is a note:

At that point, follow the instructions in the documentation folder for actual usage of the component. (Documentation is forthcoming.)

but no documentation folder found.

Is there anything anywhere?

Problem with PdfDocument loading file with size more than 5 MB.

When we try loading pdf file size more than 5 MB there is problem.
PdfDocument runs _loadOutlines with PDF trailer root.
Then in the _loadOutlines function it trys to getType from OutLines - $root->Outlines->getType()
Then there is $this->_ref which is null and it runs $this->_dereference();

Problem in this method _dereference()
There are 3 conditions in this method:

  1. It checks fetchObject is null and if it is null it gets object from context's parser.
  2. it checks obj is null and if it is null it set $this->_ref = new NullObject();
  3. it check like this : if ($obj->toString() != $this->_objNum . ' ' . $this->_genNum . ' R') {

The problem that in my case when file size more than 5 MB.
After first condition obj is set new InternalType\NullObject();
Second condition is skipped because obj is not null
In the third condition it uses method toString() and it returns null and this condition returns exception "Incorrect reference to the object" .

In my opinion it returns this exception because PdfParser\StructureParser sets wrong context. It doesn't set RefTable to the context and then $offset is null inside getObject and it returns NullObject.

Please check loading pdf file with size more than 5 MB.

Consider releasing 2.0.2

2.0.1 has a rather breaking bug that was fixed 5 months ago (214e2d1).

I'm guessing there have been some other improvements in that time that you might want to include, too.

Class 'ZendPdf\PdfDocument' not found

in my controller,
use Zendpdf\pdfdocument,

public function monthlyReportPdfAction()
{

$pdf = new PdfDocument();

$pdf->pages[0] = new Page( Page::SIZE_A4 );
$pdf->pages[0]->setFont( Font::fontWithName( Font::FONT_HELVETICA ), 24 );
$pdf->pages[0]->drawText( 'Hello world!', 240, 400 );

$pdf->save( 'example.pdf' );
}

Undocumented MemoryManager dependency

It sees that ZendPdf depends on the MemoryManager but that dependecy is not in Composer.

Fatal error: Class 'Zend\Memory\MemoryManager' not found in /vendor/zendframework/zendpdf/library/ZendPdf/PdfDocument.php

Wrong check for supported PDF versions

Not sure if I do not understand the code correctly, or the error message was not updated accordingly, but this code is somehow misleading:

https://github.com/zendframework/ZendPdf/blob/master/library/ZendPdf/PdfParser/StructureParser.php#L359-L369

From what I see it checks for PDF versions greater then 0.9 and smaller then 1.6.1. The exception tells that only 1.4 is supported.

I just realized this because I wanted to open a PDF document with version 1.6 and it does not seem to be supported.

Cyrillic Encoding Issue

Hello,

When I try to input Bulgarian Cyrillic characters via drawText(), I get this error:
Notice: iconv(): Detected an illegal character in input string in .../vendor/zendframework/zendpdf/library/ZendPdf/Resource/Font/Simple/AbstractSimple.php on line 253

Here's a sample
$page1->setFont($font, $headerSize)->drawText('Основна', 0, 800);

Tried to play with some other options, but no luck. Any chance for fix or advice? Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.