Coder Social home page Coder Social logo

Comments (12)

maechler avatar maechler commented on May 30, 2024 1

Actually it is even enough to just overwrite the footer method renderFooter .

from pdfviewhelpers.

AureliusHogan avatar AureliusHogan commented on May 30, 2024 1

Yes, now everything is fine. And it seems like it is a little faster even.
Good job!
Perfekt support!

from pdfviewhelpers.

maechler avatar maechler commented on May 30, 2024

If you use outputDestination="inline" then it is only returned inline to the browser, but not saved to the filesystem. If you want to save it to the filesystem you should use outputDestination="file" or outputDestination="file-inline" to save it AND return it to the browser.

Please see: https://docs.typo3.org/typo3cms/extensions/pdfviewhelpers/ConfigurationReference/TypoScriptReference/Index.html#document-outputdestination

I tested the different outputDestination values with the following example and everything seems to work as expected, the document is correctly saved to the filesystem.
https://docs.typo3.org/typo3cms/extensions/pdfviewhelpers/Examples/ExtendExistingPDFs/Index.html

Does this solve your issue? Or else, does it work with the example Extend Existing PDFs?

from pdfviewhelpers.

AureliusHogan avatar AureliusHogan commented on May 30, 2024

No that doesn't change anything. Thx. for the fast reply.

It's not that the file is not generated. The problem is that the content inside of the document is not generated. If I use "file-inline" the document shown is correct but the document saved is without content.

from pdfviewhelpers.

maechler avatar maechler commented on May 30, 2024

@AureliusHogan Currently I can not reproduce that issue. It seems strange to me, that the document that is returned inline, has different content than the file that is saved, because TCPDF actually reads the saved file to return it's content. See:

$f = TCPDF_STATIC::fopenLocal($name, 'wb');
if (!$f) {
$this->Error('Unable to create output file: '.$name);
}
fwrite($f, $this->getBuffer(), $this->bufferlen);
fclose($f);

and

TCPDF_STATIC::sendOutputData(file_get_contents($name), filesize($name));

Does this also happen with the example Extend Existing PDFs?
Does it work if you do not use the option sourceFile?
Did this work with v1.x? If yes, you could try to use an older version of TCPDF (v6.2.17, https://github.com/tecnickcom/TCPDF/releases)
Can you try to open the document that is saved to the filesystem with your browser?
Are there any errors in the error log?
Can you try to debug that place in TCPDF?
Can you provide your template and maybe corresponding controller action?

from pdfviewhelpers.

AureliusHogan avatar AureliusHogan commented on May 30, 2024

Yes, it worked with 1.x!
No errors in log file.
And now the realy strange thing. This is what I see in the browser:
image

And this is the file which is saved:
test-doc.pdf

And this is the file I get, when I save the inline file:
test-inline.pdf

That's crazy!!

from pdfviewhelpers.

maechler avatar maechler commented on May 30, 2024

I can view both files:

screenshot 2018-10-17 at 19 22 28

Maybe there is an issue with your PDF viewer?
Can you try to view the document test-doc.pdf in the browser? (Probably you can just drag and drop the document to your browser)
Or try to view test-inline.pdf with the viewer you used for test-doc.pdf.

from pdfviewhelpers.

AureliusHogan avatar AureliusHogan commented on May 30, 2024

Yes, I just now noticed, that Adobe Acrobat says the document has an error. So I tried to validate it as you mention in your documentation. The result is:
image

Now the question is, how to find the problem? The code I use is rather simple:

<pdf:document sourceFile="typo3conf/ext/pdfviewhelpers/Resources/Public/Examples/ExtendExistingPDFs/pdf_template.pdf" title="ESM PDF-Test" outputDestination="file-inline" outputPath="typo3temp/test.pdf">
	<pdf:page autoPageBreak="1" importPage="1" margin="{top: 58, right: 20, bottom: 40, left: 20}">
		<pdf:text>
			wir freuen uns, dass Sie sich für den folgenden Kurs angemeldet haben:
		</pdf:text>
		<pdf:text> </pdf:text>
		<pdf:headline><f:format.case mode="upper">Innerer Garten</f:format.case></pdf:headline>
		<pdf:text><f:format.raw>Hier kannst Du pflanzen was immer Du moechtest. Wichtig ist lediglich der Bezug zur Natur. Nutze die Demeter Gedanken.</f:format.raw></pdf:text>
		<pdf:text> </pdf:text>
	</pdf:page>
</pdf:document>

from pdfviewhelpers.

maechler avatar maechler commented on May 30, 2024

There seems to be an issue with the renderHeader and renderFooter methods in BasePDF. You could try to provide your own class and overwrite these methods:

<?php
namespace Vendor\YourExtension\Model;

class MyPDF extends \Bithost\Pdfviewhelpers\Model\BasePDF
{
    public function renderHeader()
    {
    }

    public function renderFooter()
    {
    }
}
plugin.tx_pdfviewhelpers.settings {
    config {
       class = Vendor\YourExtension\Model\MyPDF
    }
}

As long as you do not need the header and footer ViewHelpers, this should work. I will investigate that issue. Thanks again for reporting!

from pdfviewhelpers.

AureliusHogan avatar AureliusHogan commented on May 30, 2024

Perfect!!
That does the job for my purposes.

Thanx for the prompt support!!

from pdfviewhelpers.

maechler avatar maechler commented on May 30, 2024

@AureliusHogan I just released a new version v2.0.1 that should fix that issue. It would be nice if you could update the extension, remove the fix from yesterday and test whether this works for you.

If you like the project, please consider giving it a star :)

from pdfviewhelpers.

maechler avatar maechler commented on May 30, 2024

Perfect, thanks for reporting and testing!

from pdfviewhelpers.

Related Issues (20)

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.