Manipulating inner elements of a PDF file - javascript

Is there a way to interact with PDF internal elements as they were an HTML tag?
For example: I have a text in my embedded PDF file, and I would like to know how to highlight that text after clicking a certain button outside the embedded PDF file.

Related

Insert a word online document pages onto a html page when the page's print function is called

I have a html page that has some tables and text fields. I am displaying an online word document on html page using the embed URL provided by SharePoint(document source). When I try to print the page (window.print), I want it to include the word online pages into the print page. Is that possible? I tried using mammoth.js which was converting my word content to html but the formatting is lost during the word to html conversion and it fails to render the graphic elements such as bar graphs and so on.

How to create a single page pdf from a html file

How to create a single page pdf from a html file
I'm currently using the convert-html-to-pdf library (version: 1.0.1) to convert html files into pdf. But, the conversion is separating my html in multiple pages and it ends up breaking the code (streched divs).
Since my html file is responsive to certain needs, the size of the div blocks change on each file, and because of this I'm not able to determine when to "break" each page unless I somehow measure the size of the page and the size of the blocks.
There are two possible corrections:
create a single page pdf (this one is preferred)
mesaure the size of the page and compare with the items to make sure they are not separeted each page
The first one is supposed to be easier, but I can't find anything in the documentation that helps me do that.
I'm inclined to accept libraries suggestions to create a single page pdf.

I have downloaded a text file. Instead of downloading I want to display it in a html page using javascript

I try to convert a pdf as base64 string. I converted it and saving it to text file. Iam able to download the text file. But i dont want to download it instead of download it i want to display it in a html page. While clicking that text file i should be able to view the content of the text file. Is there any possible way to do it in javascript.
I have attached the below Link
https://codesandbox.io/s/nervous-flower-nxmtw?from-embed
You can use a iframe and put the text file link to src
Note* - the above solution is with the limited information i have understood .

How to convert PDF to html and dynamic values to the html file

In my project there is a option to upload a pdf file. In that pdf file there are some input boxes for name and ID. These values should be dynamically added to the pdf,and make it available for download.
I tried to convert pdf to html first so that I can easily add the dynamic values,but it is not coverting properly. I am able to convert this into plain text only.
Guys please help me out how to convert html to pdf either using Javascript or c# and append those dynamic values

Generate PDF of a section of a php page once rendered into HTML and CSS and account for pdf page-breaks

The system I am working on has a questionnaire in it and then shows the responses to the admin in a nice report on screen. I need to create functionality that turns the on screen report into a pdf, similar to how the browser generates a pdf of the page when you select print. Although I need to only turn a section of the page into pdf. And it would be ideal to be able to alter the HTML so that the pdf page breaks don't interfere with the presentation of the report.
You can download a pdf of how the report looks, generated by the browser functionality. This is just an example, I need the pdf to be generated by a link or button and not include the whole page (the top part in this case).
I have tried some php HTML to pdf generators, but it's difficult because the HTML is dynamically generated so I'm not sure how to send all the HTML, once rendered, to the page that creates the pdf.
To overcome the page breaks, I've considered using javascript or jquery to read the height of the div of each question within the report and then write a simple script to calculate if the next div will fit on the page and if not add a margin on top of that div so that it starts on a new page.
What software can I use to generate the pdf, given these requirements? Either php or javascript. Appreciate the help.
Have you considered Snappy for PHP? It makes use of wkhtmltopdf behind the curtains to convert any HTML document into PDF.
We are using it and it works great.
https://github.com/KnpLabs/snappy
You could try mpdf and use the page-break-inside: avoid property which is actually a CSS property. I have not used this, but it might be what you're looking for.
Looks like you can add this property to the <div> and <table> tags (mPDF Supported CSS).

Categories