Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pon not updated in getOutGradientShaders #2

Merged
merged 1 commit into from Sep 19, 2019
Merged

Pon not updated in getOutGradientShaders #2

merged 1 commit into from Sep 19, 2019

Conversation

mklemarczyk
Copy link
Contributor

Pon need to be updated before exiting the method, otherwise getObjectNumber can return old pon value.

@CLAassistant
Copy link

CLAassistant commented Feb 15, 2019

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c3aee8a on mklemarczyk:develop into 9b649b1 on tecnickcom:develop.

@@ -377,11 +377,12 @@ protected function getOutPatternObj($grad, $objref)
*/
public function getOutGradientShaders($pon)
{
$this->pon = (int) $pon;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "pon" is intentionally not updated if the document is PDF/A or there are no gradients.
Do you have a test or a specific case that explains why this has to be changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created script like this:

$pdf = new Tcpdf();
$pdf->page->add();
$pdf->setFont('pdfacourier'); // method adds new font to stack / I can pull request it, but it is not finished yet
echo $pdf->getOutPDFString();

In output printed the PON number is duplicated for objects after graph.

In Output.php:

        $out .= $this->graph->getOutGradientShaders($this->pon); // pon is correct when goes into method
        $this->pon = $this->graph->getObjectNumber(); // pon is set to value lower than it was before, which causes a problem with PON duplication

So if you say it should not be updated, therefore I can suggest two other solutions different than this one.

  1. Do not reassign the pon from method $this->graph->getObjectNumber() in the same case what the pon is not updated in getOutGradientShaders
  2. Set a higher number max(oldPon, getObjectNumber), therefore it will always get higher numer.

@nicolaasuni nicolaasuni merged commit 9355d0c into tecnickcom:develop Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants