How to show external link in PDF rendered by pdfjs - pdf

Is the only proper way to add a text layer? Can I only render text layer specifically for links in the pdf?

Related

Is there any way to save a webpage as a pdf document in flutter web view

I am currently using flutter InAppWebView Plugin. I want to save a web page as a pdf file when the url of the page is given. I have used the printCurrentPage() method of the InAppWebView plugin but it does not return the filepath back to the app after saving the file so that it can be shown in a list view in the app itself. Can anyone help me save the webpage as a pdf and show the saved files as a list view.
I have tried webcontent_converter plugin too but it looses some content of the page like images and icon to include in the pdf file.

How can I lazy-load images with Cloudinary and Strapi?

I am working on a project using Gatsby, Strapi and Cloudinary. I am deploying the frontend on Netlify and the Strapi app on Heroku (with the addition of a Postgresql database instance).
I have been searching for weeks now and but I cannot seem to find a way to lazy-load images sourced through Cloudinary.
I have replaced the default rich content editor on Strapi with the ckeditor so editors can add photos to their content. These are automatically uploaded and served by Cloudinary.
My question is, is there a way to lazy-load the images, and if so, should this be done when serving them from Cloudinary, should I do this as a Strapi middleware or simply through Gatsby?
Note: I am not sourcing the images anywhere on the front-end since it's parsed as html from Strapi. All I'm currently doing in passing the fetched content to a div using
dangerouslySetInnerHtml.
With dangerouslySetInnerHtml directive you are inserting whatever is inside your rich text as HTML content so you lose control of customizing the behavior of that content. Hence, it will be rendered all at once.
There's no built-in way of doing this except by parsing your rich text with a third-party dependency (which I haven't been able to find)/custom method that will give you the capability of wrapping your images with any custom component. The idea, either way, is to parse your rich text blocks to customize the output.
In addition, check if the images tag (<img>) comes with the loading=lazy property attached:
<img src="image.jpg" alt="..." loading="lazy">

Render images in phantom-pdf

I'm using phantom-pdf recipe to render template content. So far so good I could able to generate PDF document successfully but we have new requirement now i.e adding one or more images at the end of the document. Each image should render on its own page. Page size should be the Image size no header/footer needed.
Images can be of various sizes.
To render the image I'm using HTML tag as part of Template Content
<img id="bg" src="#this.Context.Request.Scheme://#this.Context.Request.Host#this.Context.Request.PathBase/Assets/Screenshot.png" /><div style='page-break-before: always;'></div><img id="bg" src="#this.Context.Request.Scheme://#this.Context.Request.Host#this.Context.Request.PathBase/Assets/Untitled.png" />
I can see the rendered Image in the PDF document but I see empty white space at the bottom of the page (After rendered image there is white space) Rendered PDF document
Is there any way using Phantom PDF my Page size will be image size (Header/Footer is not required)??
Currently, the business is using PPT document where each slide is an Image and transform the PPT to PDF.The generated PDF document consists one or more image and each image on its own page. (No white space/No header & footer).
You can scale image size to the full page using css. However you can't adapt your page size based on the image. phantomjs doesn't support each page in the pdf document having a different size. You would need to generate each pdf separately and then use another software to merge them together.

Yii mpdf render not working when the webpage contains images and buttons

I need to convert a html page(with images, buttons and a lot of css) to PDF and I'm using yii.
I chose mPDF over HTML2PDF(no particular reason for that.) When I render a page for converting to PDF, the PDF doesn't load, but when I use renderPartial, the page loads(only the html part works here).
I want the page to be completely converted to PDF and I tried going through the mPDF documentation but I couldn't 'find' anything useful.
this is my code :
$mPDF1 = Yii::app()->ePdf->mpdf();
$mPDF1->WriteHTML(
$this->render('render_page',
array( ...),
true ));
//Output PDF file
$mPDF1->Output();
Please let me know if I have to provide more informations...

Utilities for exporting/printing graphs?

given that the functionality for exporting graphs to SVG or PNG in the Neo4j server page is broken (see SO article), are there any utilities out there that can export a graph from Neo? something that would produce a PDF perhaps?
With not many changes, you could make it work with http://www.cloudformatter.com/CSS2Pdf to format the SVGs in browser to PDF. That set of pages has some d3 samples like this: http://www.cloudformatter.com/CSS2Pdf.SVGCharts.d3Charts
I took one of the sample charts and rendered to PDF through the Javascript and the remote formatter. The page I selected was here and I took one of those charts:
http://graphgist.neo4j.com/#!/gists/1428842b2170702400451777c2bc813f
The code needs some minor change to ensure that Neo4j puts the svg namespace on the element. The samples on that page do not. But the rendering is near perfect. See the web page on the right and PDF result on the left. I only formatted the SVG and not the whole page (where the silver background exists) and that seems to be the only difference.