Skip to content

Commit

Permalink
feat(document_il): add baseOperations element to PDFXobject
Browse files Browse the repository at this point in the history
- introduce new element `baseOperations` in rnc, xsd, and rng files
- update il_version_1.py to include `baseOperations` field
- add `on_xobj_end` method in il_creater.py for handling base operations
  • Loading branch information
awwaawwa committed Jan 22, 2025
1 parent df772ea commit 4951427
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions yadt/document_il/frontend/il_creater.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ def on_xobj_begin(self, bbox):
xobj_id=self.xobj_id,
)
)
return self.xobj_id

def on_xobj_end(self, xobj_id, base_op):
pass

def on_page_start(self):
self.current_page = il_version_1.Page(
pdf_font=[],
Expand Down
8 changes: 8 additions & 0 deletions yadt/document_il/il_version_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ class Meta:
"required": True,
},
)
base_operations: Optional[BaseOperations] = field(
default=None,
metadata={
"name": "baseOperations",
"type": "Element",
"required": True,
},
)
xobj_id: Optional[int] = field(
default=None,
metadata={
Expand Down
3 changes: 2 additions & 1 deletion yadt/document_il/il_version_1.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ PDFFont =
PDFXobject =
element pdfXobject {
attribute xobjId { xsd:int },
Box
Box,
element baseOperations { xsd:string }
}
PDFCharacter =
element pdfCharacter {
Expand Down
3 changes: 3 additions & 0 deletions yadt/document_il/il_version_1.rng
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
<data type="int"/>
</attribute>
<ref name="Box"/>
<element name="baseOperations">
<data type="string"/>
</element>
</element>
</define>
<define name="PDFCharacter">
Expand Down
1 change: 1 addition & 0 deletions yadt/document_il/il_version_1.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<xs:complexType>
<xs:sequence>
<xs:element ref="box"/>
<xs:element ref="baseOperations"/>
</xs:sequence>
<xs:attribute name="xobjId" use="required" type="xs:int"/>
</xs:complexType>
Expand Down

0 comments on commit 4951427

Please sign in to comment.