mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibPDF: Allow pages with no specified contents
The contents object may be omitted as per spec, which will just leave the page blank.
This commit is contained in:
parent
fde990ead8
commit
b90a794d78
3 changed files with 7 additions and 2 deletions
|
@ -116,7 +116,9 @@ PDFErrorOr<Page> Document::get_page(u32 index)
|
|||
else
|
||||
resources = adopt_ref(*new DictObject({}));
|
||||
|
||||
auto contents = TRY(raw_page_object->get_object(this, CommonNames::Contents));
|
||||
RefPtr<Object> contents;
|
||||
if (raw_page_object->contains(CommonNames::Contents))
|
||||
contents = TRY(raw_page_object->get_object(this, CommonNames::Contents));
|
||||
|
||||
Rectangle media_box;
|
||||
auto maybe_media_box_object = TRY(get_inheritable_object(CommonNames::MediaBox, raw_page_object));
|
||||
|
|
|
@ -30,7 +30,7 @@ struct Rectangle {
|
|||
|
||||
struct Page {
|
||||
NonnullRefPtr<DictObject> resources;
|
||||
NonnullRefPtr<Object> contents;
|
||||
RefPtr<Object> contents;
|
||||
Rectangle media_box;
|
||||
Rectangle crop_box;
|
||||
float user_unit;
|
||||
|
|
|
@ -85,6 +85,9 @@ Renderer::Renderer(RefPtr<Document> document, Page const& page, RefPtr<Gfx::Bitm
|
|||
|
||||
PDFErrorsOr<void> Renderer::render()
|
||||
{
|
||||
if (m_page.contents.is_null())
|
||||
return {};
|
||||
|
||||
// Use our own vector, as the /Content can be an array with multiple
|
||||
// streams which gets concatenated
|
||||
// FIXME: Text operators are supposed to only have effects on the current
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue