generate pdf support arabic language - javascript

I want to generate pdf file from my php script that support utf-8 "arabic language"
like -> "السلام عليكم "
that support RTL
i make small search and i found some library like fpdf but it's aint support arabic and also tpdf
and i found tcpdf but it's need as i "think" using laravel in my project ?
i am not using MVC i just using normal web development .

If you want to programtically generate the pdf and send it in email attachment the TCPDF library is the best solution for you. The TCPDF provides fonts for Arabic and Farsi. However, it looks like the TCPDF does not support RTL.
I would also suggest you to give DOMPDF a try. DOMPDF generates PDF with HTML with ease. Read more here: https://github.com/dompdf/dompdf
I have used both to generate the PDF for all kind of non-latin chars.
EDIT:
Don't forget to add dir="rtl" in the html. Please read more here: https://www.w3.org/International/questions/qa-html-dir
Also, please show your code if you can. So I can help you more.

If your page has Arabic words
<script>
window.print();
<script>
This will give you option to print or save PDF. Hope this will work.

Related

Dynamically Saving Images to a PDF template

I'm building a website where people can pick several pictures from a range.
I then want the users to be able to create a PDF using those pictures. However I want those pictures inserted in predefined positions and sizes in a template I have already created which will contain other predone materials (words pictures etc).
So my question :
its possible ?
Can anyone recommend a library which will satisfy my needs, I have had a look and I cant see any PDF libraries that seem to mention templates
Any guidance on where to start will be greatly appreciated.
Yes, this is completely possible.
I would recommend using wkhtmltopdf to generate the pdfs from an html template.
Another handy library for this kind of work is image.intervention
Both of these would work with PHP.
If you're working in javaScript you may want to use PDFKit
Edited: Only if you use php.
There are several libraries you can use to generate a pdf depending on what template you will build your pdf. I hardly recommend TCPDF. You can use html to layout the design you want or you can embed the image directly on a page. See an example here.

Export HTML as PDF in JQuery for Persian

I used some free jquery libraries like jsPDF and html2pdf to export html as PDF in jquery. But non of them work properly for Persian language. How to export/convert html to PDF for Persian with Persian fonts in jquery or javascript?
please help me!
You can use DocRaptor. It works for Persian and other utf-8 languages. but it's not free. In free version of library, advertising bar will be added to exporting PDF.
you can create a simple page with your report as html, and use Microsoft Print to PDF-se (Ctrl+P) to print to PDF-se and save locally
jsPDF can only render simple HTML to PDF
See below image, There is a tag which is not displaying properly in PDF view:
You need to use iTextSharp in order to generate PDF from server side. it will also support Persian font.
Try to use html2pdf library for properly export Persian/Arabic characters.

convert html into jpg and send mail - PHP

I have an HTML which contains images and javascript charts. I want to convert that HTML into an image and send as an attachment through email.
Is it possible?
If yes, which library should I use for this task?
Yes it's possible, but for that you need to use phantomjs.
Here is a php library i used for phantomjs.
http://jonnnnyw.github.io/php-phantomjs/
Its pure php solution (using phantomjs browser) and is very easy to use. Just install this library through composer and that's it you should be good to go.
Note: This solution is valid if you want to take screenshot of your html page through its URL.
Hope it helps :-)

PHP generate PDF and edit

I would like to ask
Is it possible to edit the PDF file? For example, insert a new pages between pages , like add page between page 17 and 19.
Which library can i use?
one way to do this is to use ghostscript to split the pdf into individual page images and then you can add additional pages and rearrange pages as needed with tcpdf or similar pdf library.
You can generate pdf easily using FPDF library http://www.fpdf.org/. But you can not edit them via this library. You can use FPDI library mentioned here: PDF Editing in PHP?.
Here is my view:
It is easy to edit Hypertext rather than PDF it self. I use TCPDF to convert HTML to PDF.
Take a look at this. It might be helpful : TCPDF_import is not bringing in an existing file
Thanks, Let us know if you find a better solution.

PDF forms get online content

Would it be possible to use the inbuilt Javascript in adobe pdf forms to get contents/scrape a web page?
When I googled if Javascript could do this there where CSP errors,
but pdf forms does not have this as far as I know.
thanks,
g3
As you suspected, it is not possible to achieve this with Acrobat's Javascript extensions.
There are a number of third party tools that can convert a website to a pdf. If you also need to build a form, rather than just convert a webpage, you could write a program that would leverage a third party conversion tool, then build the form using Acrobat's Interapplication Communication API reference. If you're more comfortable with Javascript, you could even use the PDDoc's JSObject to build the form with Javascript.
You could use the wkhtmltopdf tool to get the HTML Content of a website and save it to a PDF
Then you can simply run
wkhtmltopdf http://google.com google.pdf to get the Content of Google.com and save it to the PDF "google.pdf".
It is possible. Check out the methods of Net.HTTP found in the "JavaScript for Acrobat API Reference". You might find a more recent version of the reference here.

Categories

Resources