Commit Graph

33 Commits

Author SHA1 Message Date
Plaisted
c6ed29bda4 cleanup stream writing to only write multiple when needed 2021-02-07 10:37:31 -06:00
Plaisted
44ee6d394f cleanup font usage, fix some build system issues with older c# version 2021-02-06 15:13:22 -06:00
Plaisted
7f42ad0af9 refactored previous work to fit pr #250 2021-02-06 12:24:53 -06:00
InusualZ
7126564eef Allow to copy pages from another document
This is a naive implementation, because if you copy multiple pages from the same document, the recipient document would be bloated with duplicated resources
2020-12-20 19:13:19 +00:00
InusualZ
ba5bc1f031 Allow to have multiple content stream in a page
You can create new content stream (NewContentStreamAfter, NewContentStreamBefore) and select (SelectContentStream) which one we are editing at the moment
2020-12-19 10:41:36 +00:00
Eliot Jones
d8e0263ec7 #215 support filling rectangles on pdf builder 2020-11-17 17:00:13 -04:00
Eliot Jones
54f227ea95 add support for extracting grayscale images and inline images 2020-08-22 15:08:59 +01:00
Eliot Jones
5ac7a957d0 add initial png support 2020-08-21 10:50:17 +01:00
Eliot Jones
09b951f667 expose font details on individual letters
also fixes a regression for image extraction
2020-04-25 17:15:26 +01:00
BobLd
002d8dc06d Move Path-Painting Operators to PathPainting folder 2020-04-05 17:58:57 +01:00
Eliot Jones
7212b9e38c enable re-use of jpeg images between or within pages
returns a reference to the added image object when calling addjpeg so that it can be shared between or within pages meaning the image is only written to the output file once but can appear multiple times.

this image doesn't seem to be displaying correctly in adobe reader.
2020-03-16 19:32:57 +00:00
Eliot Jones
19462d79f0 add support for jpeg images in pdf document builder
since jpegs can be trivially embedded in pdf documents without changes to the data stream this is the first image format we will support. currently this is a naive approach which doesn't share an image resources between pages. ideally we will either de-duplicated images when added, return a re-usable key once an image is added, or both.
2020-03-16 19:32:57 +00:00
Eliot Jones
e2c3b6dc8b update package icon #96 and readme
updates nuget package definition to use new format of package icon as required by #96. add readme information for hyperlinks and truetype fonts #8.
2020-01-06 12:28:54 +00:00
Eliot Jones
b7554e2838 compress page content stream
when writing a new pdf document we now use the flate filter to compress the page content stream. we also move letters in the same word into the same showtext operation.
2020-01-04 10:27:07 +00:00
Eliot Jones
f319e7f4b5 adds per character byte mapping to truetype #98
this starts to add logic for per-character mapping of unicode characters to byte values for truetype fonts in the pdf document builder. in order to support unicode characters outside the 0-255 range when creating new pdf documents without using composite fonts, we need to map values outside these range into this range. to do this we start at 1 and map each character we encounter to the next code, up to a maximum of 255. we provide a custom tounicode cmap in the font dictionary which maps these byte values, 0-255, back to unicode code points (short).

we also provide a custom firstchar, lastchar and widths array for the font mapping just the values we use.

since fonts no longer contain just the latin character set the font descriptor enum is set to have the symbolic flag set. this means values will be looked up in either the mac-roman (1, 0) or windows-symbol (3, 0) cmap tables (these cmap tables are distinct from cmap tables in the pdf file) inside the actual truetype font bytes. this means the currently generated font file is invalid, because while the widths array and tounicode cmap return the correct values the actual font itself returns whatever values where in those positions before the remapping occurred.

in order to fix this we will need to override the windows-symbol cmap contained in the underlying truetype font to match our mapping. this will be a lot of work and involve significant rewriting of the font file itself, in order to preserve checksum integrity.
2020-01-04 10:27:07 +00:00
Eliot Jones
87528199c6 use byte values when showing text for document builder #98
when writing text content the current show text operator was just writing the unicode string value and hoping it produced the correct value in the resulting document despite the values being consumed in a different encoding. this change adds a method to retrieve the corresponding byte value for a unicode character and uses that to write a hex show text operator to the page content. this is only implemented for standard14 fonts in this change.

for standard14 fonts we look up the corresponding name for the unicode value from the adobe glyph list. once we find the corresponding glyph name we look up the code value in the encoding we have chosen when writing standard14 fonts (macromanencoding). this value is then the byte value written to the show text operator. if the value does not appear in any of the lookups we throw a not support exception.

this also adds a test case which will still fail for czech characters in a truetype font, the issue reported in #98.
2019-12-28 14:42:27 +00:00
Eliot Jones
935d182888 use doubles where calculations are being run 2019-12-24 12:22:17 +00:00
vadik299
cc767b8cd6
Merge branch 'master' into master 2019-08-16 18:34:57 -04:00
Vasya
22278f64c4 Added TextSequence 2019-08-11 14:55:59 -04:00
Eliot Jones
4dde4ca0c1 add colors to letters based on current font and graphics state 2019-08-05 19:26:10 +01:00
BobLd
65647febcf - Adding a TextDirection enum.
- In the Letter class:
     - Renaming 'Location' to 'StartBaseLine' and adding 'EndBaseLine' for better localisation of the letter ('Location' is also kept).
     - Adding TextDirection.
2019-04-19 21:33:31 +01:00
Eliot Jones
62dc93919c add the ability to set page content directly on the page builder 2019-01-03 22:25:26 +00:00
Eliot Jones
abd9212862 fix document creation behaviour for multiple pages 2018-12-30 14:39:49 +00:00
Eliot Jones
4d5518a599 move annotations to experimental access, support changing color state for document creation and update readme 2018-12-30 14:12:04 +00:00
Eliot Jones
d9052e1388 update readme and document public api for document creation 2018-12-28 16:55:46 +00:00
Eliot Jones
9a1879829d move path class and add doc comments to document creation api 2018-12-25 10:37:00 +00:00
Eliot Jones
924fc7b37f #21 support writing lines, curves and rectangles. add documentinformation to output. rename characterpath 2018-12-12 00:09:15 +00:00
Eliot Jones
29f9885fc4 #21 fix widths for system font baskerville old face 2018-12-11 21:29:39 +00:00
Eliot Jones
dc5d2b8fdd #21 further changes to truetype to get accurate information out for creating documents 2018-12-08 18:04:02 +00:00
Eliot Jones
d6a896dcb0 #21 enable document creation using standard 14 font to test output 2018-12-02 16:14:55 +00:00
Eliot Jones
eecb871ed1 #21 quick draft of minimal writing logic requirements 2018-11-27 20:00:38 +00:00
Eliot Jones
d5a50f2236 #8 tidy up truetype font internally. some more work on a potential document creation api 2018-11-25 13:56:27 +00:00
Eliot Jones
c56da9a25a start looking into the mvp for document generation 2018-11-24 19:38:16 +00:00