Commit Graph

40 Commits

Author SHA1 Message Date
BobLd
3ee9ac7915 Implement FillStrokePath() operator and filling rule. 2020-04-05 17:58:57 +01:00
BobLd
43b40da5d5 Change Subpath to path where necessary 2020-04-05 17:58:57 +01:00
BobLd
002d8dc06d Move Path-Painting Operators to PathPainting folder 2020-04-05 17:58:57 +01:00
BobLd
6677641b37 Create PdfPath
Rename ClippingRule to FillingRule
Move FillingRule from Subpath to Path
2020-04-05 17:58:57 +01:00
Eliot Jones
f1be6634a7 add a bunch more performance improvements
filter provider becomes single instance and no longer has constructor parameters.

tokenizers use list and stringbuilder pools to reduce allocations.

system font finder becomes static to preserve file cache across all documents.
2020-04-05 15:34:47 +01: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
BobLd
1d095af974 Implement Modify Clipping operations 2020-02-24 11:20:56 +00:00
BobLd
84bab1b627 Add basic marked content extraction capabilities 2020-01-08 10:34:01 +00:00
Eliot Jones
63b118b141 handle type1 fonts disguised as truetype
if the font descriptor uses the fromsubtype flag the actual type of the font can differ from that specified in the font dictionary. in this case a truetype font actually contains a type1c, compact font format, font. in this case we fall back to using the type1 parser.

also handles a closesubpath command appearing without any path construction operators.
2020-01-07 16:49:21 +00:00
vadik299
f00eb5efa2 Update AppendRectangle.cs
(fix) Rectangle width and height should be also transformed by CurrentTransformationMatrix
2020-01-07 00:23:10 -05:00
Eliot Jones
74774995d6 complete move of truetype, afm and standard14 fonts
the 3 font types mentioned are moved to the new fonts project, any referenced types are moved to the core project. most truetype classes are made public #8.
2020-01-04 22:39:13 +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
935d182888 use doubles where calculations are being run 2019-12-24 12:22:17 +00:00
Eliot Jones
e38da0a403 add support for alternative colorspace in separation colorspaces #89 2019-12-06 17:23:15 +00:00
Eliot Jones
68bcaf3901 #55 move support for images to page and add inline images
support both xobject and inline images. adds unsupported filters so that exceptions are only thrown when accessing lazily evaluated image.bytes property rather than when opening the page.

treat all warnings as errors.
2019-10-08 14:04:36 +01:00
Eliot Jones
c5d03bca97 move application of transformation matrix outside path 2019-08-08 21:19:18 +01:00
Eliot Jones
0b9ae1db13 add color information to the operation context. create color classes for letters and paths to use 2019-08-04 16:47:47 +01:00
Eliot Jones
364bd25fa8 #48 add handling of inline image data to pdf content parsing
an inline image in a pdf content stream starts with the bi tag, then id declares the start of image data and ei the end. attempting to parse the bytes after the id tag as usual resulted in errors. this change adds special case handling for inline images.
2019-08-03 15:42:19 +01:00
vadimy
7d3a0929b6 Refactoring and fixing according to Eliot's comments 2019-07-24 00:00:00 -04:00
vadimy
b9d0cca2a6 Added "Paths" collection to Page object.
Added matrix transformation to path operators.
2019-07-16 00:35:29 -04:00
Eliot Jones
453faf50af start adding colorspace path operations to the operation context 2019-07-10 21:31:23 +01:00
Eliot Jones
c495065178 support gs operator, fix systemfonts, apply rotation to glyphs
- begin adding support for extended graphics state (the 'gs' operator) including setting the font #39.
- apply page level rotation to the glyph bounding box and width to get correct glyph sizes #41.
- wrap page rotation in a value type to ensure the value is restricted to right angle rotations and provide convenience members #42.
- fix bug where system font finder never worked for truetype fonts because it began reading the file from the wrong offset.
2019-07-06 14:03:23 +01:00
Eliot Jones
cdf5546a1b #24 add the missing operations for the graphics state 2019-01-06 15:47:33 +00:00
Eliot Jones
406f0e6184 #24 add missing marked content operators, still 2 to go 2019-01-06 11:34:25 +00:00
Eliot Jones
cd84edbdc8 #26 add missing operation and expose the content stream directly to the user through the page 2019-01-04 19:54:55 +00:00
Eliot Jones
611786855b #26 make all operations writable and test 2019-01-04 19:17:54 +00:00
Eliot Jones
2a30631ab7 #26 make all operation classes public and test 2019-01-04 18:55:36 +00:00
Eliot Jones
5c8a77bf33 #26 make almost all operators public 2019-01-03 22:20:53 +00:00
Eliot Jones
29daeb5806 #26 prepare more content stream operations for public api 2019-01-02 23:14:13 +00:00
Eliot Jones
ea9ac795ff #26 add writing logic and comments to more graphics state operations 2019-01-01 18:00:04 +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
713d600ee7 remove unused code and add writing support for more graphics operations 2018-12-25 10:51:36 +00:00
Eliot Jones
39786ac00a #21 add a test for accented characters and fill in more writing methods for content stream operators
the output is currently incorrect for accented characters
2018-12-14 18:33:01 +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
d6a896dcb0 #21 enable document creation using standard 14 font to test output 2018-12-02 16:14:55 +00:00
Eliot Jones
0f68dfeb19 #10 move tokens to the root namespace for discoverability. upgrade xunit versions. there is a bug with test discovery for stringtokenizertests 2018-11-16 20:00:12 +00:00
Eliot Jones
1fe54c5f49 add xobjects to pages, fix parsing truetype fonts where the glyphs use the repeat flag. 2018-04-26 22:22:29 +01:00
Eliot Jones
b6585292fb start adding support for reading and applying XObjects 2018-04-21 16:24:37 +01:00
Eliot Jones
a0deab446b switch classes still using the cos object approach to the tokenization approach initally used for parsing cmap files. 2018-01-19 00:35:04 +00:00
Eliot Jones
ec62542b64 change the project name to something silly 2018-01-10 19:49:32 +00:00