1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-04 16:07:57 +03:00
Commit Graph

99 Commits

Author SHA1 Message Date
Guillaume Ayoub
b7a9fe7dcc Update copyright 2019-03-04 11:04:06 +01:00
Guillaume Ayoub
b4500bf25e Fix more escape sequences 2018-10-26 15:32:34 +02:00
Guillaume Ayoub
f0b77a25ee Typo 2018-08-08 15:43:41 +02:00
Guillaume Ayoub
a55a391f66 Rename misleading function name write_pdf_attachments 2018-08-08 14:41:03 +02:00
Guillaume Ayoub
0834615b78 Don't use pdfrw anymore
pdfrw is a great piece of software, but we don't know PDF enough to debug the
problems we've met. It's safer to use the new cairo API and get back to manual
edition for attachments and bleed boxes.

We only have two regressions for now:
- some internal links are broken,
- PDF producer is not overwritten.

A mail has been sent to cairo's mailing-list about that:
https://lists.cairographics.org/archives/cairo/2018-August/028694.html

Fix #639, #615, fix #596, fix #565.
2018-08-06 17:38:02 +02:00
Guillaume Ayoub
ce84073f1a Use Latin-1-decoded strings instead of bytestrings in pdfrw streams
Fix #558.
2018-01-28 16:21:48 +01:00
Guillaume Ayoub
ea9ffc9a3f Lint 2018-01-14 02:09:25 +01:00
Guillaume Ayoub
16e8186568 Drop Python 2 support 2018-01-14 01:48:17 +01:00
Guillaume Ayoub
9724e706bc Remove prints 2017-12-11 01:39:25 +01:00
Guillaume Ayoub
e5dcab7cf3 Cleanups 2017-10-05 08:45:50 +02:00
Guillaume Ayoub
34153d273e Merge pull request #517 from dark-light-cz/pdfrw
Added support to work with bleed like padding (bleed-top/right/bottom…
2017-10-05 06:45:49 +02:00
Guillaume Ayoub
c81c973d15 Use bytes for PDF compressed files streams
Cleans code and fixes Python 2 support.
2017-10-04 22:01:20 +02:00
Václav Pokluda
05446f5eff Added support to work with bleed like padding (bleed-top/right/bottom/left) 2017-09-21 12:03:09 +02:00
Guillaume Ayoub
71d54095bd Add support of marks and bleed pages properties
Fix #471.
2017-09-05 15:44:50 +02:00
Guillaume Ayoub
f29d23b5dc Use pdfrw to edit PDF metadata and test them 2017-09-04 17:27:56 +02:00
Guillaume Ayoub
fcd6bf7070 Clean and document the logging levels
Related to #488.
2017-07-25 13:59:56 +02:00
Guillaume Ayoub
4f4b4ed598 Use isort in tests 2017-03-25 00:33:36 +01:00
Guillaume Ayoub
da96902bda Fix many PEP8 errors and warnings
- Put line breaks after operators (that's OK)
- Don't assign lambdas, use functions (well, that's really explicit in
  PEP8, it's really verbose but why not)
- Put imports at the beginning of the file (only special cases for us)
2016-01-15 12:48:25 +01:00
Guillaume Ayoub
0719aa096b Fix pdf_escape for python 2 again 2015-12-16 18:45:41 +01:00
Guillaume Ayoub
ff04ba8513 Fix pdf_escape for Python 2 2015-12-16 18:29:20 +01:00
Guillaume Ayoub
36338b4067 Escape parenthesis in URIs when generating PDFs
Fix #284
2015-12-16 17:16:10 +01:00
Alex Eftimie
93f497bf11 Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
Guillaume Ayoub
f0da0374bf Don't crash when attachments are not available (fix #250) 2015-08-14 13:51:56 +02:00
Simon Sapin
465483336d Fix failing test_pdf.test_embedded_files test on PyPy.
WeasyPrint still doesn’t actually work on PyPy with non-trivial documents,
but at least Travis-CI is green again.
2014-09-16 21:07:07 +01:00
Simon Sapin
dd9ff47c94 Fix code formatting 2014-04-27 18:16:14 +01:00
Colin Leitner
da916a32a6 Added an Attachment class for attachments provided through the API instead of the URL/description tuples 2014-04-25 23:35:43 +02:00
Colin Leitner
e244b8119b Renamed is_internal to link_type, which is less confusing 2014-04-23 17:12:54 +02:00
Colin Leitner
b7a5c46626 Moved the UTF-8 decoding logic from compat.py to pdf.py, where it's actually necessary to special case the unquoted result 2014-04-22 21:48:11 +02:00
Colin Leitner
a084a5b517 Refactored attachments attribute from the HTML class to an argument for write_pdf 2014-04-22 20:40:46 +02:00
Colin Leitner
851167f19d Removed usage of unnecessary binascii module in favor of hexdigest 2014-04-22 19:29:37 +02:00
Colin Leitner
a9fd32c14c Change filename logic for PDF attachments
This patch honors the filename key of a fetched resource, which can be set by
the `Content-Disposition` or `Content-Type` headers and uses
`mimetypes.guess_extension` for resources that lack any indication of a
filename.
2014-04-18 16:40:47 +02:00
Colin Leitner
846a5bedb4 Refactored the url_fetcher argument for write_pdf to an attribute of the Document class 2014-04-18 15:11:45 +02:00
Colin Leitner
83ef0e9c17 Use write_new_object where applicable in _write_compressed_file_object and check that the object numbers are still in sync 2014-04-07 20:03:30 +02:00
Colin Leitner
17f81862ff Refactored write_compressed_file_object to a top-level function 2014-04-07 19:55:23 +02:00
Colin Leitner
ff89ef0a73 Removed unnecessary PDF output simplification for empty unicode strings 2014-04-07 19:48:33 +02:00
Colin Leitner
12734323f4 Fixed an expression which led to a KeyError for internal links. 2014-04-06 15:37:25 +02:00
Colin Leitner
7ac01f0519 Added support for PDF file annotations. 2014-04-04 18:46:00 +02:00
Colin Leitner
e458380190 Added support for PDF attachments (v2) 2014-04-04 12:32:21 +02:00
Simon Sapin
c34221d215 2014. 2014-01-10 14:27:02 +00:00
Florian Mounier
e3d7bad55b Be careful logging.warn is deprecated 2013-08-19 14:38:09 +02:00
Simon Sapin
eb08733938 Add PDF metadata parsed from HTML. Fix #77.
<title> → /Title
<meta name=author> → /Author
<meta name=description> → /Subject
<meta name=keywords> → /Keywords
<meta name=generator> → /Creator
<meta name=dcterms.created> → /CreationDate
<meta name=dcterms.modified> → /ModDate
"WeasyPrint vX.Y" → /Producer
2013-07-22 00:13:11 +01:00
Pierre-Alain Mignot
76b87c82f4 Fix #101: Write PDF bookmarks/outline correctly.
The PDF spec says that the target of a bookmark/outline entry contains
the *object ID* of the target page. We previously wrote the *page number*,
which for some reason still worked in some PDF viewers.
2013-06-28 18:33:14 +01:00
Simon Sapin
1d1bf9cdc9 Flake8. 2013-04-11 12:08:53 +02:00
Simon Sapin
171438f48e 2013 2013-04-03 16:23:48 +02:00
Simon Sapin
c70b00b5b8 More WIP: cairocffi and pango cffi. 2012-12-29 01:36:06 +01:00
Simon Sapin
0444be5fba Fix PDF metadata with zoom != 1 2012-11-22 22:49:30 +01:00
Simon Sapin
54b46c4b46 Typo fix 2012-10-08 12:13:33 +02:00
Simon Sapin
a7131bd10f Remove unused imports 2012-10-05 22:12:19 +02:00
Simon Sapin
ba06e7eecc Nicer whitespace in PDF objects. 2012-10-05 22:06:38 +02:00
Simon Sapin
732f7187a4 Fix bookmarks writing in PDF.
The new prepare_metadata() already adds bookmark_root_id to
all values, no need to add it again in write_pdf_metadata()
2012-10-05 21:59:08 +02:00