# SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved.
# Non-Commercial Freeware and Commercial Software.
# This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C# project.
# The latest version of the code is available on the site www.pullenti.ru

import typing
from pullenti.unisharp.Streams import Stream

from pullenti.unitext.internal.pdf.PdfObject import PdfObject

class PdfReference(PdfObject):
    
    def to_string_ex(self, lev : int) -> str:
        return "[R 0 {0}]".format(self.id0_)
    
    def write0_(self, s : Stream) -> None:
        buf = "{0} 0 R".format(self.write_id).encode("ASCII", 'ignore')
        s.write(buf, 0, len(buf))
    
    def get_all_references(self, refs : typing.List['PdfReference'], ids : typing.List[int]) -> None:
        refs.append(self)
    
    @staticmethod
    def _new184(_arg1 : int, _arg2 : int) -> 'PdfReference':
        res = PdfReference()
        res.write_id = _arg1
        res.id0_ = _arg2
        return res
    
    @staticmethod
    def _new186(_arg1 : int) -> 'PdfReference':
        res = PdfReference()
        res.write_id = _arg1
        return res