Commit graph

73 commits

Author SHA1 Message Date
HarryPaulo
f4518e2cf9
fix(print): Added properties page-width, page-height (#16045) 2022-02-23 13:49:40 +05:30
Rohan Bansal
64c18a3187 feat: allow more print page size options 2021-10-26 17:04:41 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Suraj Shetty
291d7b0f16 fix: Call is_rtl function to get the actual value 2021-08-10 10:13:19 +05:30
Suraj Shetty
0b3402236c fix: Add layout direction to pdf template 2021-07-05 14:44:04 +05:30
Suraj Shetty
70f5df6a05 chore: debug 2021-06-17 18:50:21 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Faris Ansari
e72bb135e1 fix: Asset URLs
Helpers to get asset path
Python: frappe.utils.jinja_globals.bundled_asset
JS: frappe.assets.bundled_asset
2021-04-29 14:47:52 +05:30
Faris Ansari
34c6d099b1 fix: Update all /assets urls with new urls 2021-04-24 16:24:08 +05:30
prssanna
a4d8161a87 fix: print pdf fixes 2020-11-24 12:29:27 +05:30
prssanna
76bb9fc608 feat: skeleton loading state for print preview 2020-11-10 11:03:13 +05:30
Aditya Hase
16fc29e48d
fix(pdf): frappe.local.request is not available in backgound jobs and tests
Use frappe.utils.get_host_name instead of frappe.local.request.host
2020-10-27 14:18:36 +05:30
Aditya Hase
3f5f6f3b21
fix(pdf): Remove in_test check from get_pdf 2020-10-27 14:18:35 +05:30
Suraj Shetty
d254933a7c fix: Build cookie jar only if request object is present 2020-10-24 14:12:59 +05:30
Marica
1ad3bb76a5
fix: Skip using cookie-jar to set cookies if via tests (#11700) 2020-10-13 13:35:42 +05:30
Aditya Hase
3c9f265091
fix(pdf): Restrict cookies to the host domain
Use wkhtmltopdf's cookie-jar options to set domain
Reference: 7952b0f3e7/src/lib/multipageloader.cc (L532-L536)
Cookie format Reference: https://doc.qt.io/qt-5/qnetworkcookie.html#parseCookies

Also, werkzeug 0.16.x shows port in the host attribute.
https://werkzeug.palletsprojects.com/en/0.16.x/wrappers/#werkzeug.wrappers.BaseRequest.host
2020-09-09 20:58:42 +05:30
Aditya Hase
8feba5fa9b
fix(pdf): Cleanup temporary files after pdf generation
This was removed in https://github.com/frappe/frappe/pull/7358
2020-09-09 20:52:45 +05:30
Rushabh Mehta
8c8f7313f4
fix(minor): make utils explicit in safe_globals (#11408)
* fix(minor): make utils explicit in safe_globals

* fix(minor): import subprocess

* fix(minor): fix globals in safe_eval;

* fix(minor): import subprocess

* fix(minor): add test

* fix(minor): webhook.py

* fix(minor): document_type_mapping.py
2020-09-03 14:26:01 +05:30
Suraj Shetty
49aba26696 fix: Use non-pretty version of HTML for pdf generation 2020-07-14 16:36:24 +05:30
dependabot[bot]
bdb77ba521
chore(deps): bump bleach from 2.1.4 to 3.1.2 (#9779)
* chore(deps): bump bleach from 2.1.4 to 3.1.2

Bumps [bleach](https://github.com/mozilla/bleach) from 2.1.4 to 3.1.2.
- [Release notes](https://github.com/mozilla/bleach/releases)
- [Changelog](https://github.com/mozilla/bleach/blob/master/CHANGES)
- [Commits](https://github.com/mozilla/bleach/compare/v2.1.4...v3.1.2)

Signed-off-by: dependabot[bot] <support@github.com>

* chore: use html.parser instead of html5lib

bleach no longer ships html5lib as a requirement and instead has
included it in the system. we can switch to using html.parser instead;
which is not an external dependency unlike html5lib.

source: https://github.com/mozilla/bleach/blob/master/CHANGES#L206

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>

* chore: use html5lib from bleach

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>

* chore: import html5lib from bleach._vendor

fixes issue where bs4 is unable to find html5lib in the tree:

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: bleach._vendor.html5lib. Do you need to install a parser library?

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>

* chore: just give up and install html5lib as a dependency

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chinmay D. Pai <chinmaydpai@gmail.com>
2020-03-25 00:20:57 +05:30
Alirio Castro
23d3f0e63b
feat: Indicate orientation for PDF file (#9660)
Same as other attributes, we could indicate default orientation by indicating in the .print-format css class without hardcoding, which is useful for cloud users.

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2020-03-16 17:31:28 +05:30
Rohan Bansal
67791ff194 fix(pdf): error when trying to print PDFs 2019-12-26 14:44:19 +05:30
Rohit Waghchaure
7494328106 fix: disable smart shrinking for version 0.12.5 2019-10-25 18:36:26 +05:30
Rohit Waghchaure
7fc55d2cbd fix: font size showing small after upgrade to 0.12.5 2019-10-14 17:43:41 +05:30
ci2014
f0b59df21c Let developers choose the margins (#8513)
* Let developers choose the margins

Let the developers choose the margins

* fix: remove trailing whitespace
2019-10-03 06:25:38 +00:00
Shivam Mishra
8bc753b881 chore: disable pdf encryption for multipdf 2019-06-06 16:26:44 +05:30
Suraj Shetty
d67bcd2212 fix: Define filedata before it is used 2019-05-05 12:23:46 +05:30
Shivam Mishra
87bb91b64f fix: key error on password 2019-04-30 09:41:25 +05:30
Shivam Mishra
8e29bc4bf7 fix: possible fix to encoding issues in py3 2019-04-27 18:03:00 +05:30
Shivam Mishra
01a2df7e5a feat: code imporvements 2019-04-27 16:26:13 +05:30
Shivam Mishra
02c6abe609 feat: minor changes to pdf.py 2019-04-27 16:22:56 +05:30
Shivam Mishra
a9ca81370b fix: encoded password 2019-04-25 18:22:14 +05:30
Shivam Mishra
d791285ac2 feat: Added encryption feature for pdfs 2019-04-25 17:23:38 +05:30
Sagar Vora
fe3fe0a4b8 Merge branch 'master' into staging-fixes 2019-01-29 17:08:58 +05:30
Aditya Hase
36bc812c94 fix(security): Make server-side PDF rendering tighter 2019-01-28 12:41:21 +05:30
Aditya Hase
6b72faf44f style: Linting fixes (#6809)
* style: Remove unused imports

* style: Remove unused local variables
2019-01-23 16:39:55 +05:30
Saif
25827755b5 PDF allow parsing header-spacing (#6286)
Simply allow parsing header-spacing from custom css.
2018-10-22 10:13:26 +05:30
Nabin Hait
854b068ee9 Fixed merge conflict 2018-07-31 13:15:15 +05:30
Shreya Shah
4c20d1f68f using regex instead of soup to parse pdf page margins (#5883)
* using regex instead of soup to parse pdf page margins

* Fix codacy
2018-07-30 14:32:33 +05:30
Sagar Vora
5ddcf40a11 [python3] let PdfFileReader handle file opening (#5878)
In Python 3, file() is deprecated. 
PdfFileReader can internally handle file opening and closing, so file() no longer necessary.

See description of stream parameter here:
https://pythonhosted.org/PyPDF2/PdfFileReader.html#PyPDF2.PdfFileReader

Alternatively, open() can be used.
2018-07-27 11:55:48 +05:30
Prateeksha Singh
d2dfda2711
Merge pull request #4973 from lasalesi/configurablepdfborder
using regex instead of soup to parse pdf page margins
2018-05-03 17:41:52 +05:30
Achilles Rasquinha
796348cd60 fix indentation 2018-03-29 15:39:49 +05:30
Austin Bischoff
bf7ad3f3f1 pdf.py does not handle output properly if ContentNotFoundError is thrown (#5296)
If wkhtmltopdf throws a ContentNotFoundError exception (even though there is content) or other catchable exceptions the output keyword is not updated properly as it is in the try: section if no exception is thrown.   This causes the PDF being returned to be empty, empty PdfFileWriter() created in print_format.py line 26. This causes issues like https://github.com/frappe/erpnext/issues/13124 to occur where the viewer.js throws an error due to a bad pdf file.  The ContentNotFoundError exception is happening due to no header image in the letterhead or its a bad link being used when multi printing. 

The whole get_pdf() function should be rebuilt to test for ContentNotFoundError and other errors from wkhtmltopdf and then use a secondary try/catch to check for any other IOErrors related to being able to read the PDF back in from the file.  Right now this is not DRY since I basically copy and pasted lines 18 - 22 under line 31 so that if there is an error but the file exists the output will still be appended properly.
2018-03-29 12:00:05 +05:30
lasalesi
a60002726a corrected trailing whitespace (codacy) 2018-03-08 11:18:21 +01:00
Faris Ansari
cd54b6f6a1 Query Report (#5097)
* [listview] Show freeze message

* Call refresh on same page

* Simplify query_report lifecycle, Print partially working

* PDF Print, frappe.render_pdf

* Show freeze message

* Export
2018-02-28 17:10:09 +05:30
lasalesi
70756cf3c6 using regex instead of soup to parse pdf page margins 2018-02-06 13:46:23 +01:00
Juan F Fernández
3c8689e4a2 [FIX] Fixed problem with margins in pdf (see #3451 #4235 #4239) (#4297) 2017-10-18 09:21:36 +03:00
rohitwaghchaure
192fae169c [Fix] Letter head not displaying proper in the pdf (#4251) 2017-10-05 13:01:35 +05:30
maxtorete
c4ab2de7fd Fixed problem with margin top and bottom overwritten in print format (#3451) 2017-09-23 03:46:13 +02:00
Aditya Hase
000d9a41b6 Use PyPDF2 instead of pyPdf 2017-08-11 00:39:24 +05:30