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

PDFreactor losslessly embed pdf pages #5493

Open
haapakanni opened this issue Dec 20, 2019 · 4 comments
Open

PDFreactor losslessly embed pdf pages #5493

haapakanni opened this issue Dec 20, 2019 · 4 comments

Comments

@haapakanni
Copy link

@haapakanni haapakanni commented Dec 20, 2019

Feature Request

Feature description

Feature improves significantly quality of pdf output by using pdfreactor losslessly embed pdfs. Todo so please refactor models/Document/Tag/Pdf::frontend method, https://github.com/pimcore/pimcore/blob/master/models/Document/Tag/Pdf.php, to meet the pdfreactor documentation, https://www.pdfreactor.com/product/doc_html/index.html#PdfImages, by using the pdf file instead of lossy thumbnail image. May also reduce filesize of output pdf to even half and more of original size depending on source pdf.

Code example

            /* Use the pdf file as src to improve quality and to reduce output file size */
            $code = <<<HTML
                <div id="$divId" class="pimcore-pdfViewer">
                    <img src="$pdfPath" />
                </div>
HTML;
            
            /* Use the lossy thumbnail img only for preview tab in UI */
            if (isset($_GET["pimcore_preview"]) && $_GET["pimcore_preview"]) {
                $code = <<<HTML
                <div id="$divId" class="pimcore-pdfViewer">
                    <a href="$pdfPath" target="_blank"><img src="$thumbnailPath"></a>
                 </div>
HTML;
            }
@haapakanni haapakanni changed the title PDFreactor losslessly embed pages from other PDFs as images PDFreactor losslessly embed pdf pages Dec 20, 2019
@haapakanni

This comment has been minimized.

Copy link
Author

@haapakanni haapakanni commented Jan 7, 2020

Overriding the pimcore pdf model would be one way to implement the issue but it's not possible (yet) as referred here for another purpose https://talk.pimcore.org/t/is-overriding-pimcore-pdf-model-supported/2518

@haapakanni

This comment has been minimized.

Copy link
Author

@haapakanni haapakanni commented Jan 8, 2020

Also css-property-ro-source-area implementation https://www.pdfreactor.com/product/doc_html/index.html#css-property-ro-source-area would be nice addition. Perhaps custom property named as "ro-source-area" could be set for pdf-assets and then generated as attribute for the img-html element in the models/Document/Tag/Pdf::frontend method.

@haapakanni

This comment has been minimized.

Copy link
Author

@haapakanni haapakanni commented Jan 9, 2020

Comparison and example between losslessly embed pdf and lossy as attachment.
lossless-embredded-pdf-by-pdfreactor

@fashxp

This comment has been minimized.

Copy link
Member

@fashxp fashxp commented Jan 9, 2020

if we add this feature, it needs to be a configuration option (since the pdf editable can also be used on normal document pages and browsers cannot render pdf then).

could you provide a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.