GithubHelp home page GithubHelp logo

contributte / pdf Goto Github PK

View Code? Open in Web Editor NEW
40.0 7.0 27.0 288 KB

๐Ÿ“ฎ PDF toolbox for Nette Framework using mPDF

Home Page: https://contributte.org/packages/contributte/pdf.html

License: GNU Lesser General Public License v3.0

PHP 89.66% HTML 7.11% Makefile 3.23%
contributte pdf nette mpdf php

pdf's Introduction

Website ๐Ÿš€ contributte.org | Contact ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป f3l1x.io | Twitter ๐Ÿฆ @contributte

Usage

To install latest version of contributte/pdf use Composer.

composer require contributte/pdf

Documentation

For details on how to use this package, check out our documentation.

Versions

State Version Branch PHP
dev ^7.1 master 8.1+
stable ^7.0 master 8.1+

Development

See how to contribute to this package. This package is currently maintained by these authors.


Consider to support contributte development team. Also thank you for using this package.

pdf's People

Contributors

andrewhlavac avatar castamir avatar ciki avatar f3l1x avatar grogy avatar janbarasek avatar jkoty avatar petrparolek avatar pomezny avatar romanmatyus avatar solcik avatar stopka avatar tezar avatar tomasvotruba 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdf's Issues

PdfResponse::mpdfConfig does not allow fontDir

Mpdf can be created with config param fontDir.

$mpdf = new Mpdf([
    'tempDir' => $myTempDir,
    'fontDir' => [$myCustomFontDir],
    'fontData' =>[$myCustomFontData],
    'default_font' => 'poppins',
]);

When I add mpdfConfig with fontDir to PdfResponse

$PdfResponse = new PdfResponse();
$PdfResponse->mpdfConfig = [
    'tempDir' => $myTempDir,
    'fontdata' => [$myCustomFontData],
    'fontDir' => [$myCustomFontDir],
    'default_font' => 'poppins',
];
$mpdf = $PdfResponse->getMPDF();

I become error:
Cannot write to an undeclared property [Mpdf\Mpdf]::$fontDir
[Mpdf\Mpdf]::$fontDir is set as private property (vendor/mpdf/mpdf/src/Mpdf.php:283)

Using of Mpdf methods AddFontDirectory and AddFont do not apply changes, or font is not applied.
Fonts are used when the necessary configuration options are added to the object creation.

failing tests

 FAILED: Joseki\Application\Responses\PdfResponse and Symfony crawler | PdfResponse.symfony.crawler.phpt

   Failed: "... (\xfe\xff\x00m\x00P\x00D\x00F\x00 \x008\x00.\x000\x00.\x004)\n/Title (\xfe\xff\x00N\x00e\x00w\x00 \x00d\x00o\x00c\x00u\x00m\x00e\x00n\x00t)\n/Auth..." should be 

       ... "... (\xfe\xff\x00m\x00P\x00D\x00F\x00 \x008\x00.\x000\x00.\x000)\n/Title (\xfe\xff\x00N\x00e\x00w\x00 \x00d\x00o\x00c\x00u\x00m\x00e\x00n\x00t)\n/Auth..."

PHP 7.2 Support stable?

I'd like to use this library in a PHP 7.2 project. When will the PHP 7.2 support, that is currently in master, be released as stable? Is there anything preventing it?

Refactoring, margin API change

At the moment, code is no as clean as I want it to be. Code is not easy to read.

In the last commit: 822ced0, margin getter got duplicated. One (the older one) return margin as an array, the new one returns string. String is not wanted any more.

So I'm going to separate code in several sections (getter+setters, core, build and output) and internally change the way how margins are stored and merge margin getters.

Page format as array

MPDF allows to set page format as array, but the setPageFormat() function in PdfResponse has strict type of string.

Expected:
$pdf->setPageFormat([99, 210]); //is OK

Result:
Exception.

Remove .git

Please remove .git folder from your repository, it's making a mess when I try your project with composer and Nette.

The problem is that I versioned folder vendor and your files are already shows as commited.

Custom tmp folder not working

When I try to set custom folder for temp files like said in the documentation:

services:
	-
		factory: Contributte\PdfResponse\PdfResponse
		setup:
			- $mpdfConfig([tempDir: %tempDir%/mpdf])

I stil get this error:

Temporary files directory "/home/martinez/Sites/akobjednavky.local/vendor/mpdf/mpdf/src/Config/../../tmp/mpdf" is not writable

It still tries to write to the vendor temp folder. The config is not set, the $mpdfConfig variable is empty. I tried to clear the cache as well.

Non working css rows

Hi,
I want to create PDF from latte template with boostrap template and i have little problem with this error: A non-numeric value encountered That will be fine but i discovered bigger problem that pdf don't create rows and column in good way http://prntscr.com/grhgn6
That is PDF export and it should looked like this http://prntscr.com/grhh5w

mPDF 5.7.4

Hello, why it's version of mPDF 5.7.4 disabled in composer?
mPDF 5.7.3 it's not compatible with PHP 7.

Create release branches for PHP 5 and PHP7

  • create branches (v3.0 for version 3 and keep master for version 4)
  • composer - create branch alias
  • composer - min stability php7 for php7 branch
  • fix php7 compatibility
  • upgrade to php7 syntax and features

Incorrect documentation of setting temp directory

In documentation section Configuration of custom temp dir for mPDF in PdfResponse
Is example of setting configuration of tempDir that is not working.

I repost solution from nette.org forum

Configuration should be:

services:
  - Contributte\PdfResponse\PdfResponseFactory([tempDir: %tempDir%/pdf])

and then creation of response object in PHP should be like:

$response = $this->pdfResponseFactory->createResponse();

instead of

$response = new PdfResponse();

No option to use underscopes instead of dashes in filename

Would be nice to have option to replace dashes with underscores or vice-versa while saving PDF with save method. Because filename is webalized everytime (which is good), but other systems (for example in my case) accept only pdf's with underscores in filename.

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.