65 Commits

Author SHA1 Message Date
Adrian-George Bostan
5efaa02e23
Use page indirect object for internal outline destinations (#359)
* Use page indirect object for internal outlines

* Use page indirect object in creator outline destinations

* Adapt creator test case to test outline creation and retrieval
2020-05-22 16:19:43 +00:00
Adrian-George Bostan
d2941b5477
Add reader method for checking if the AcroForm needs repair (#356)
* Add AcroFormNeeds repair method

* Add AcroForm repair check test case
2020-05-20 16:04:02 +00:00
Adrian-George Bostan
80d51c5532
Add reader AcroForm repair functionality (#351)
* Add method for retrieving widget parent form field

* Add reader method for repairing AcroForm

* Add AcroForm repair test case

* Add AcroForm repair options

* RepairAcroForm documentation improvements
2020-05-19 12:42:07 +00:00
Gunnsteinn Hall
ad2a1e9c9d
Subsetting fixes (#346)
* Update unitype lib which improves subsetting

* Add text extraction check to creator font subsetting example

Helps ensure ToUnicode map is set correctly.

* Clean up import

* Fix spelling
2020-05-12 07:15:09 +00:00
Adrian-George Bostan
aef6e5e976
Fix CMap generation and serialization for composite fonts (#344)
* Fix CMap charcode mapping serialization

* Improve CMap generation in the NewCompositePdfFontFromTTF function
2020-05-08 00:15:09 +00:00
Gunnsteinn Hall
9ef2f27694
Support for subsetting fonts (#335)
* Subsetting of TrueType CID fonts using unitype

* Simplify call to SubsetRegistered so can be done right after loading font via creator finalizer

* Add an EnableFontSubsetting function on the creator to simplify font subsetting for creator users
2020-05-05 00:17:27 +00:00
Adrian-George Bostan
d84d0c4375
Form fill fixes (#328)
* Parse form fields with embedded widget annotations

* Try matching fields both by partial and full names on form fill

* Use default font if widget font is not found when generating appearance

* Add JSON extract and fill test case
2020-04-24 16:48:06 +00:00
Adrian-George Bostan
cb0166e96b
Add low level PageLabels support (#325)
* Add reader method for retriving the PageLabels entry from the catalog
* Add writer method for setting the PageLabels entry in the catalog.
* Add creator method for adding page labels for the output file
* Add creator page labels test case
* Minor page labels test case correction
2020-04-22 21:17:33 +00:00
Alexey Pavlyukov
a69d788171
Add timestamp signature handler (#301)
* Add timestamp signature handler

* Add timestamp signature handler test

* fix PR issues

* fix PR issues

* fix PR issues

* Fix

Co-authored-by: Gunnsteinn Hall <gunnsteinn.hall@gmail.com>
2020-04-22 20:21:53 +00:00
Alfred Hall
bc5c0d95d3
Merge pull request #320 from gunnsth/dev-writer-error-handling
Fix error handling in Writer
2020-04-18 17:13:40 +00:00
Gunnsteinn Hall
6308fc8014 Fix error handling in write, with a testcase. 2020-04-18 13:48:44 +00:00
Gunnsteinn Hall
fa5f13501b Fixes 2020-04-18 11:12:26 +00:00
Gunnsteinn Hall
d23d4b8c79 Add NewCompositePdfFontFromTTF to load composite TTF from memory 2020-04-18 10:37:10 +00:00
Adrian-George Bostan
a351532cd3
Prevent Type 0 function evaluation crash (#309) 2020-04-15 21:05:20 +00:00
Adrian-George Bostan
ff79a9b1bd
Prevent recursion when building invalid outline tree (#308) 2020-04-15 19:33:36 +00:00
Adrian-George Bostan
d605803bd2
Prevent panics (#305)
* Remove panic on font nil Differences array

* Remove unused bcmaps function

* Remove panics from the core/security/crypt package

* Fix extractor invalid Do operand crash

* Fix TTF parser crash for invalid hhea number of hMetrics

* Remove ECB crypt panics

* Remove standard_r6 panics

* Remove panic from render package
2020-04-14 21:09:16 +00:00
Jacek Kucharczyk
ad0b31ea1b
Optimizer fix for the CCITTFax Encoder. ISS #243. Fixes JBIG2 i386 architecture compile issue. (#297)
* Fixed issue #243. Added optimize integration tests.

* Minor style change.

* XObjImage getParamsDict updates Columns and Rows.

* Added doc file for the optimize/tests package.

* UpdateParams for CCITTFax Encoder accepts Width and Height also. Removed 
GetParamsDict Columns and Rows parameters from model.Image and 
model.XObjImage.

* Fix i386 issue for the jbig2 arithmetic encoder.

* Added 386 architecture to the .travis/cross_build.sh
2020-04-08 11:11:49 +00:00
Jacek Kucharczyk
29efa30439
JBIG2 Encoder support for inserting binary images into PDF (#288)
* Added JBIG2 PDF support
* Added JBIG2 Encoder binary image requirements
* PR #288 revision r1 fixes
* PR #288 revision r2 fixes
2020-04-03 20:54:59 +00:00
Adrian-George Bostan
64a43b38d2
Prevent crashing when processing content stream (#291)
* Skip invalid pop operation on empty graphics state stacks
* Fix clipping input values to size for Type 0 Functions
* Do not pass invalid Q content stream operator to external handlers
2020-04-01 20:08:41 +00:00
Adrian-George Bostan
edba514087 Use NRGBA when loading model.Image instances from Go images 2020-03-26 21:47:00 +02:00
Adrian-George Bostan
1d46fb4cc6
Parse ttf encoding subtable 31 after subtable 10 (#273) 2020-03-07 13:08:30 +00:00
Gunnsteinn Hall
937669cfed
Add basic glyph metrics support for Type 0 CID fonts (#272)
* Add basic glyph metrics support for Type 0 CID fonts
* Initialize font widths map if no W array is present
2020-03-05 18:47:16 +00:00
Peter Williams
e056c0e4d4
Fixed PdfColorspaceSpecialIndexed.ImageToRGB() (#259)
* Fixed PdfColorspaceSpecialIndexed.ImageToRGB() Fixes https://github.com/unidoc/unipdf/issues/258
* Fixed indexed colorspace bounds checking.
* Being super cautious to prevent a divide by zero error. I don't think the base cs can have <1 cpts.
* Updated image hash in extract_images_test.go to match new indexed colorspace code.
* add testfile from unipdf#258
2020-02-26 13:26:20 +00:00
Adrian-George Bostan
9de5fe644e
Add PdfFont text encoding methods (#257)
* Add PdfFont method for encoding runes to charcode bytes
* Add getter method for CMap nbits
* Take CMap nbits into account when encoding text
* Adapt font test cases to include text encoding testing
2020-02-17 22:54:20 +00:00
Adrian-George Bostan
e2b3c6e6ba
Add predefined CMaps for Type 0 composite fonts (#246)
* Add packed predefined cmaps
* Add cmap cid range parsing
* Load base cmap for predefined cmaps
* Refactor pdfFont to Unicode methods
* Preserve CharcodeBytesToUnicode behavior
* Add support for CID-keyed Type 0 fonts
* Add method documentation for the cmap package
* Refactor and document charcode to Unicode conversion code
* Add more cmap parsing test cases
* Add more method documentation in the cmap package.
* Remove unused code from the bcmaps package
* Improve cmap test case
* Assume identity when encoder is missing on regenerating field appearance
* Add missing encoder log message
* Add inverse CMap mappings
* Add CMap encoder
* Address golint notices and small fix in the cmap package
* Keep smaller charcodes when generating cmap inverse mappings
* Update extractor test case
* Keep latest supplement charcodes/CIDs when computing inverse mappings
* Fix comment typo
2020-02-07 19:56:30 +00:00
Gunnsteinn Hall
81e3e14eb9
Merge pull request #242 from unidoc/master
Master into development
2020-01-30 22:24:56 +00:00
Adrian-George Bostan
3bd083475d Minor refactoring 2020-01-21 22:18:11 +02:00
Adrian-George Bostan
692ead8496 Improve outline destination parsing 2020-01-21 22:11:20 +02:00
Samuel Stauffer
d3a160ba41 Follow object indirections in PdfPage.GetMediaBox 2020-01-17 14:35:46 -08:00
Adrian-George Bostan
7c5d52cca5 Add outline test case 2020-01-16 20:52:59 +02:00
Adrian-George Bostan
029d4c34d8 Rename NewOutlineFromReaderOutline to GetOutlines and move it in the reader 2020-01-16 19:51:34 +02:00
Adrian-George Bostan
84dd2d145a Add ToOutlineTree method for outline conversion 2020-01-16 19:31:54 +02:00
Adrian-George Bostan
dbd9e96abc Fix method comment typo 2020-01-15 23:36:07 +02:00
Adrian-George Bostan
9a553c30ba Add NewOutlineFromReaderOutline 2020-01-15 23:02:05 +02:00
Adrian-George Bostan
8afe2c21ed Export Outline and OutlineItem entries 2020-01-15 20:04:06 +02:00
Adrian-George Bostan
2c395a6598 Add GetContext method for exporting the outline tree node context 2020-01-15 19:42:16 +02:00
Adrian-George Bostan
ac736a2f78 Improve traversal of outline item nodes in the GetOutlinesFlattened method 2020-01-14 21:39:12 +02:00
Adrian-George Bostan
33530535e3 Use utf-16 encoding for serializing outline item titles 2020-01-13 20:56:02 +02:00
Adrian-George Bostan
53623b5157 Prevent recursive parsing of invalid circular outlines 2019-12-17 20:29:02 +02:00
Adrian-George Bostan
23aec77478 Add basic support for UTF-16 text encodings (#203)
* Add UTF-16 text encoder
2019-11-28 00:47:00 +00:00
Gabriel Vasile
d1a81d79d2 Add NewPdfFontFromTTF(io.ReadSeeker) function. (#199)
* Add NewPdfFontFromTTF(io.ReadSeeker) function.
2019-11-20 23:05:40 +00:00
Peter Williams
362ba7349d Changes to make the lazy reader work on the PaperCut corpus (#194) 2019-10-28 20:49:07 +00:00
Adrian-George Bostan
0bd31c8f84 Parse signature certificate arrays on signature validation 2019-09-26 21:32:56 +03:00
Adrian-George Bostan
da010a9d44 Prevent recursion when parsing outlines 2019-09-19 19:38:24 +03:00
Adrian-George Bostan
07615469c9 Fix panic when loading composite fonts (#164)
* Fix loading composite fonts when no glyph names are provided
* Make handling of unsupported runes consistent between paragraph components
2019-09-07 11:19:39 +00:00
Adrian-George Bostan
56e81d3a1a Take decode arrays into account when processing grayscale images (#159)
* Take decode arrays into account when processing grayscale images
* Adapt image extraction test case hashes
* Minor refactoring in the ColorAt image method
* Always return vanilla data from the jbig2 decoder
2019-08-30 19:16:23 +00:00
Gunnsteinn Hall
b1c851b7b0
Becoded action support (#161)
* initial commit to add action support
* Add support for all actions as defined in the specs
* Implement filespec for actions
* Add url filespec test
* update file test
* Implement remarks + add tests
2019-08-30 08:50:30 +00:00
Adrian-George Bostan
febf633172 Image memory optimizations (#149)
* Add ColorAt method for images
* Avoid resample on image to Go image conversion
* Avoid resample when converting grayscale image to RGB
* Preserve old behavior of image to Go image conversion
* Add missing case in the ToGoImage method
* Fix grayscale to RGB image conversion
* Improve code documentation
* Fix color extraction for CMYK and 4 bit RGB
* Add test case for the ColorAt image method
* Avoid resampling when converting CMYK image to RGB
* Add notice comment for the GetSamples/SetSamples image methods
2019-08-22 20:15:16 +00:00
Gunnsteinn Hall
d2e7eda95f
Lazy loading improvements (#131)
* Simplify lazy loading logic, remove redundancy. Fixes, improved performance.
* Additional lazy reader fixes
* Make core.IsNullObject method resolve references
* Adapt appender test cases for lazy reader usage
2019-07-24 21:19:13 +00:00
Adrian-George Bostan
550d79472e Add option to generate appearance dicts when filling form fields (#128) 2019-07-22 17:19:02 +00:00