summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibPDF
AgeCommit message (Collapse)Author
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-31LibPDF: Fix mismatched class/struct declarationMatthew Olsson
2022-03-31LibPDF: Rename Command to OperatorMatthew Olsson
This is the correct name, according to the spec
2022-03-31LibPDF: Fix some base-encoding-related crashesMatthew Olsson
2022-03-31LibPDF: Add Type0 and TrueType fontsMatthew Olsson
2022-03-31LibPDF: Abstract Type1 font dataMatthew Olsson
TTF font types will use the same data
2022-03-31LibPDF: Accept font size in PDFFont::get_char_widthMatthew Olsson
This will be required for TTF fonts
2022-03-31LibPDF: Move font files into their own directoryMatthew Olsson
2022-03-31LibPDF: Use Font /Widths array to derive character widthsMatthew Olsson
This makes the spacing between chars _much_ better!
2022-03-31LibPDF: Use AntiAliasingPainter in Renderer when possibleMatthew Olsson
2022-03-31LibPDF: Fix more bad Renderer text positioning calculationsMatthew Olsson
2022-03-31LibPDF: Handle SCN and scn operatorsMatthew Olsson
2022-03-31LibPDF: Add basic ICCBased color space handlingMatthew Olsson
2022-03-31LibPDF: Move color space creation from Renderer to ColorSpaceMatthew Olsson
2022-03-29LibPDF: Attempt to unecrypt strings and streamsMatthew Olsson
2022-03-29LibPDF: Require Document* in Parser constructorMatthew Olsson
This makes it a bit easier to avoid calling parser->set_document, an issue which cost me ~30 minutes to find.
2022-03-29LibPDF: Keep track of the current object index/generation while ParsingMatthew Olsson
This information is required to decrypt encrypted strings/streams.
2022-03-29LibPDF: Add implementation of the Standard security handlerMatthew Olsson
Security handlers manage encryption and decription of PDF files. The standard security handler uses RC4/MD5 to perform its crypto (AES as well, but that is not yet implemented).
2022-03-29LibPDF: Get rid of PlainText/Encoded StreamObjectMatthew Olsson
This was a small optimization to allow a stream object to simply hold a reference to the bytes in a PDF document rather than duplicating them. However, as we move into features such as encryption, this optimization does more harm than good. This can be revisited in the future if necessary.
2022-03-29LibPDF: Change CommonNames' enumerator macro parameter nameMatthew Olsson
Apparently "V" is a PDF property. Let's hope "A" isn't!
2022-03-29LibPDF: Store a PDFFont in the Renderer's text stateMatthew Olsson
2022-03-29LibPDF: Add initial support for Type1 fontsMatthew Olsson
This is enough to get a char code -> code point mapping
2022-03-29LibPDF: Add support for builtin and custom EncodingsMatthew Olsson
2022-03-07LibPDF: Allow newlines between xref table and "trailer" keywordMatthew Olsson
2022-03-07LibPDF: Fix "incorrect" matrix multiplication in RendererMatthew Olsson
Incorrect is in quotes because the spec (both 1.7 and 2.0) specify this multiplication as it was originally! However, flipping the order of operations here makes the text in all of my test cases render in the correct position. The CTM is a transformation matrix between the text coordinate system and the device coordinate system. However, being on the right-side of the multiplication means that the CTM scale parameters don't have any influence on the translation component of the left-side matrix. This oddity is what originally led to me just trying this change to see if it worked.
2022-03-07LibPDF: Implement marked renderer operations as nopsMatthew Olsson
2022-03-07LibPDF: Fix bad hex string parsing logicMatthew Olsson
2022-03-07LibPDF: Remove useless hex string substring callMatthew Olsson
2022-03-07LibPDF: Support all Dest typesMatthew Olsson
2022-03-07LibPDF: Propagate errors in Renderer/PDFViewerMatthew Olsson
2022-03-07LibPDF: Propagate ColorSpace errorsMatthew Olsson
2022-03-07LibPDF: Propagate errors in Parser and DocumentMatthew Olsson
2022-03-07LibPDF: Fix the zoom-related text scaling issueMatthew Olsson
Previously, text spacing on a page would only look correct on very zoomed-in pages. When the page was zoomed out, the spacing between characters was very large. The cause for this was incorrect initial values for the Tc (character spacing) and Tw (word spacing) text parameters. The initial values were too large, but they were only about 3-5 pixels, which is why the error was only observable for smaller pages. The text placement still isn't perfect, but it is _much_ better!
2022-03-07LibPDF: Remove unused function in ParserMatthew Olsson
2022-01-24LibPDF: Make Filter::decode() return ErrorOrSam Atkins
2022-01-24AK+Userland: Make AK::decode_hex() return ErrorOrSam Atkins
This lets us propagate the reason why it failed up to the caller. :^)
2022-01-24Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOrSam Atkins
Apologies for the enormous commit, but I don't see a way to split this up nicely. In the vast majority of cases it's a simple change. A few extra places can use TRY instead of manual error checking though. :^)
2022-01-08LibPDF: Convert `PDF::Parser::m_document` from `RefPtr` to `WeakPtr`Simon Woertz
Otherwise both `PDF::Document` and `PDF::Parser` have a `RefPtr` pointing to each other which leads to a memory leak due to a circular dependency.
2021-11-17AK: Convert AK::Format formatting helpers to returning ErrorOr<void>Andreas Kling
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
2021-11-16LibPDF: Check if there is data left before consumingSimon Woertz
Add a check to `Parser::consume_eol` to ensure that there is more data to read before actually consuming any data. Not checking if there is data left leads to failing an assertion in case of e.g., a truncated pdf file.
2021-11-11Userland: Include Vector.h in a few places to make HeaderCheck happyAli Mohammad Pur
This header was being transitively pulled in, but that no longer happens after 5f7d008791f9e358638283dc2f0d709a601344ff.
2021-11-11Everywhere: Pass AK::ReadonlyBytes by valueAndreas Kling
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-10AK: Make ByteBuffer::try_* functions return ErrorOr<void>Andreas Kling
Same as Vector, ByteBuffer now also signals allocation failure by returning an ENOMEM Error instead of a bool, allowing us to use the TRY() and MUST() patterns.
2021-10-30LibPDF: Parser::parse_header() return false if remaining bytes is zeroBrendan Coles
2021-09-21LibPDF: Rely on default-constructor of VariantBen Wiederhake
2021-09-20LibPDF: Replace Value class by AK::VariantBen Wiederhake
This decreases the memory consumption by LibPDF by 4 bytes per Value, compensating exactly for the increase in an earlier commit. :^)
2021-09-20LibPDF: Extract reference bitpacking into dedicated classBen Wiederhake
2021-09-20LibPDF: Move inline function definitionBen Wiederhake
This breaks the dependency cycle between Parser and Document.
2021-09-20LibPDF: Break weird dependency cycleBen Wiederhake
Old situation: Object.h defines Object Object.h defines ArrayObject ArrayObject requires the definition of Object ArrayObject requires the definition of Value Value.h defines Value Value requires the definition of Object Therefore, a file with the single line "#include <Value.h>" used to raise compilation errors; certainly not something that one might expect from a library. This patch splits up the definitions in Object.h to break the cycle. Now, Object.h only defines Object, Value.h still only defines Value (and includes Object.h), and the new header ObjectDerivatives.h defines ArrayObject (and includes both Object.h and Value.h).