I am trying to generate a PDF from Html page. The Html includes various data returned from django view and also from Vue.js
I tried using 'Weasyprint' but it only generated data that returned from Django but not the charts and graphs that were generated from Vue. What will be an easy way to generate all the data as well as the graphs in PDF from the Html page.
To generate a PDF with those charts, you will need to render the web-page first (in a browser) in order to run the client-side code and use that "result" to generate the final PDF.
It will depend on where you want to generate that PDF (on the server or on the client). In case it is on the server, one possible solution is to use phantomJS (or other similar projects) to render and save the result in a file with render().
Related
I am working in a GIS app and I have to present the result of a dataset in HTML, but the HTML file is too large.
I now want to convert it to PDF using phantom. Does anyone have a working example?
Hello I need to extract Feature table from protein page in NCBI webpage. Example of page is here:
https://www.ncbi.nlm.nih.gov/protein/Q8TB36.3
I am writing script in Python 3.x, using BeautifulSoup package for getting html of page. Problem is, that if I download html source of this page, I am not getting Feature table - Feature table is generated by javascript?
Is there any way, how to call that script and generate Feature table on my own? Or any other way how to extract desired data from page?
Thank you for advice
The JavaScript fetch data from this url:
https://www.ncbi.nlm.nih.gov/sviewer/viewer.fcgi?id=269849682&db=protein&report=genpept&extrafeat=984&fmt_mask=0&retmode=html&withmarkup=on&tool=portal&log$=seqview&maxplex=3&maxdownloadsize=1000000
You can make requests to this url and get the data you need.
You can find this url in Chrome Dev tools.
How can I add PDF417 2-D barcode (as an image) to a Acroform PDF?
I have a process in place where I populate a PDF "templates" with data using a XFDF file that I build server side. Staying in the same workflow, I'd like to either use XFDF or FDF files to add a barcode to the PDF.
I'm using full-stack JavaScript environment, where the Nodejs environment runs server side. I'm using PDFTK Server (JavaScript on the server calling out to a PDFTK.exe).
I can use any tool/technique within my technology stack (Nodejs/Javascript). Also, this solution must work server side only.
The PDF "template" currently uses a Adobe Lifecycle "Paper Forms Barcode" control for the barcode. When we fill this PDF form out with data manually, the XFA script embedded within the PDF automatically populates the "Paper Forms Barcode" control with the PDF417 barcode.
When I run PDFTK Server's form fill command to populate the PDF with the XFDF data I build server side, I believe the XFA (and hence any intelligence behind the "Paper Forms Barcode" control) is automatically removed from the resulting output PDF.
I can optionally remove the "Paper Forms Barcode" control and use any other control available.
pdf417-js seems to get my close to building a PDF417 barcode, but it's client side. And also, I can't see a way to build an image output.
From my research it seems I might need to remove the existing "Paper Forms Barcode" control and add an image somehow to the PDF. Then possibly use PDFTK to somehow merge a PDF that I have filled with data from my existing process with another PDF that simply has the barcode.
I never seen an example of XFDF or FDF inserting an image into the PDF. I've read where one can dynamically add an image (icon) to a button control via FDF (I've found no hard example of this), but haven't been able to get anything working.
FDF does support inserting images as icons into Button fields. I am, however, not sure whether XFDF does it. You may have to convert the image into PDF format.
For an industrial-strength use, you might consider dedicated tools, such as FDFMerge by Appligent (which would also allow to selectively flatten the barcode field (and others too)).
Both FDF and XFDF support adding images to PDF pages. Some background first, Adobe Acrobat and Reader can submit form data as well as comment annotations. It can also import form data as well as comment annotations. Therefore, FDF and XFDF can represent both form data and comment annotations.
Images can be added to a PDF via FDF or XFDF by representing them as a stamp annotation. Acrobat can certainly import these but most server tools don't know about the <annots> element of the XFDF and even if they did, they generally can't create an annotation appearance based on the annotation properties. One can; the Datalogics PDF Java Toolkit is capable of importing XFDF with stamp annotations.
In my project, I want to somehow display a pdf file on the page. For this, I am trying to use the <object> tag. So far, so good, since the pdf lives in the /public folder in my Rails app.
The problem is that now I want the user to be able to display a pdf that is on his pc. I tried using Javascript to alter the <object> tag, but that does not work since Rails generates a new GET request to get the file, and the file is not on the server. Any ideas of how I can solve this?
I have tried using PDF.js, but it does not integrate well in the assets pipeline. Also, I would have to customize and hack the code to add some other functionalities, so PDF.js is kinda off the table (at least for now).
You can use the wicked_pdf gem to generate pdf then use Google PDF viewer for displaying it
I'm developing a web application on a Play framework 2.2.0 (Scala). The application is generally taking some input from the user, and then calls external module which in turn processes the input and generates html report. The report has a rather complex structure with html, javascript and json data, all put into different files. Then I wish to be able to render this report to the user by the Play framework, without him having to download report in an archive.
I tried to put these report files to some directory in the assets, and Redirect, but this won't work in production. Then I tried to use Ok.sendFile inline, but since content depends on other files the report does not render correctly.
I wonder if there is any "intended" way to render such dynamically generated HTML to the user?