Referência da API Objective-C
O PDF Oxide oferece bindings idiomáticos de Objective-C (o framework PdfOxide / o CocoaPod PdfOxide) construídos sobre a ABI em C. Os wrappers NSObject são donos dos seus handles nativos e os liberam em -dealloc (ou de forma antecipada via -close); as strings e buffers em C retornados são copiados para NSString/NSData, e os códigos de status diferentes de sucesso aparecem como NSError no POXErrorDomain. Todo método público é coberto, um a um, por POXApiCoverageTests.
# Podfile
pod 'PdfOxide', '~> 0.3.69'
#import <PdfOxide/POXPdfOxide.h>
Para a API em Rust, veja a Referência da API Rust. Para a API em Python, veja a Referência da API Python. Para a API em JavaScript, veja a Referência da API JavaScript (Node.js) ou a Referência da API JavaScript (WASM).
Todos os índices de página são baseados em zero. Bounding boxes usam POXBbox { float x; float y; float width; float height; } em pontos do espaço do usuário do PDF; a versão do PDF é informada como POXVersion { uint8_t major; uint8_t minor; }.
POXDocument
A classe principal para abrir, extrair, renderizar e inspecionar um PDF.
Abertura
+ (nullable instancetype)openPath:(NSString*)path error:(NSError**)error;
Abre um PDF a partir de um caminho do sistema de arquivos.
+ (nullable instancetype)openFromBytes:(NSData*)data error:(NSError**)error;
Abre um PDF a partir de bytes em memória.
+ (nullable instancetype)openWithPassword:(NSString*)path password:(NSString*)password error:(NSError**)error;
Abre um PDF protegido por senha em uma única etapa.
+ (nullable instancetype)openFromDocxBytes:(NSData*)data error:(NSError**)error;
+ (nullable instancetype)openFromPptxBytes:(NSData*)data error:(NSError**)error;
+ (nullable instancetype)openFromXlsxBytes:(NSData*)data error:(NSError**)error;
Converte bytes em memória de um documento Office (Word/PowerPoint/Excel) em um documento PDF aberto.
- (BOOL)authenticate:(NSString*)password error:(NSError**)error;
Autentica um documento criptografado depois de aberto; retorna YES em caso de sucesso, NO para senha incorreta.
Exportação para Office
- (nullable NSData*)toDocxWithError:(NSError**)error;
- (nullable NSData*)toPptxWithError:(NSError**)error;
- (nullable NSData*)toXlsxWithError:(NSError**)error;
Exporta o documento para bytes de Word / PowerPoint / Excel.
Informações do Documento
- (NSInteger)pageCountError:(NSError**)error;
Número de páginas, ou -1 em caso de erro.
- (POXVersion)version;
Versão do PDF como uma struct POXVersion.
- (BOOL)isEncrypted;
- (BOOL)hasStructureTree;
- (BOOL)hasXfa;
Consultas de criptografia, árvore de estrutura de PDF Tagged e presença de formulário XFA.
Texto & Conversão
- (nullable NSString*)extractText:(NSInteger)page error:(NSError**)error;
Extrai texto puro de uma única página.
- (nullable NSString*)toPlainText:(NSInteger)page error:(NSError**)error;
- (nullable NSString*)toMarkdown:(NSInteger)page error:(NSError**)error;
- (nullable NSString*)toHtml:(NSInteger)page error:(NSError**)error;
Converte uma única página para texto puro, Markdown ou HTML.
- (nullable NSString*)toPlainTextAllWithError:(NSError**)error;
- (nullable NSString*)toMarkdownAllWithError:(NSError**)error;
- (nullable NSString*)toHtmlAllWithError:(NSError**)error;
Converte todas as páginas para texto puro, Markdown ou HTML.
- (nullable NSString*)extractStructuredJson:(NSInteger)page error:(NSError**)error;
Extrai uma página como JSON estruturado (spans, geometria, fontes).
Extração de Elementos
- (nullable NSArray<POXChar*>*)extractChars:(NSInteger)page error:(NSError**)error;
- (nullable NSArray<POXWord*>*)extractWords:(NSInteger)page error:(NSError**)error;
- (nullable NSArray<POXTextLine*>*)extractTextLines:(NSInteger)page error:(NSError**)error;
- (nullable NSArray<POXTable*>*)extractTables:(NSInteger)page error:(NSError**)error;
Extrai caracteres, palavras, linhas de texto e tabelas com metadados de posicionamento.
- (nullable NSArray<POXFont*>*)embeddedFonts:(NSInteger)page error:(NSError**)error;
- (nullable NSArray<POXImage*>*)embeddedImages:(NSInteger)page error:(NSError**)error;
- (nullable NSArray<POXAnnotation*>*)pageAnnotations:(NSInteger)page error:(NSError**)error;
- (nullable NSArray<POXPath*>*)extractPaths:(NSInteger)page error:(NSError**)error;
Extrai fontes incorporadas, imagens incorporadas, anotações de página e caminhos vetoriais.
Busca
- (nullable NSArray<POXSearchResult*>*)search:(NSInteger)page term:(NSString*)term caseSensitive:(BOOL)caseSensitive error:(NSError**)error;
Busca por term em uma única página.
- (nullable NSArray<POXSearchResult*>*)searchAll:(NSString*)term caseSensitive:(BOOL)caseSensitive error:(NSError**)error;
Busca por term em todo o documento.
Extração Dentro de um Retângulo
- (nullable NSString*)extractTextInRect:(NSInteger)page x:(float)x y:(float)y width:(float)width height:(float)height error:(NSError**)error;
- (nullable NSArray<POXWord*>*)extractWordsInRect:(NSInteger)page x:(float)x y:(float)y width:(float)width height:(float)height error:(NSError**)error;
- (nullable NSArray<POXTextLine*>*)extractLinesInRect:(NSInteger)page x:(float)x y:(float)y width:(float)width height:(float)height error:(NSError**)error;
- (nullable NSArray<POXTable*>*)extractTablesInRect:(NSInteger)page x:(float)x y:(float)y width:(float)width height:(float)height error:(NSError**)error;
- (nullable NSArray<POXImage*>*)extractImagesInRect:(NSInteger)page x:(float)x y:(float)y width:(float)width height:(float)height error:(NSError**)error;
Extrai texto, palavras, linhas, tabelas ou imagens restritos a uma região retangular (pontos do espaço do usuário).
Extração Automática & Classificação
- (nullable NSString*)extractTextAuto:(NSInteger)page error:(NSError**)error;
Seleciona automaticamente extração de texto nativa ou via OCR para uma página.
- (nullable NSString*)extractAllTextWithError:(NSError**)error;
Extrai texto de todo o documento.
- (nullable NSString*)extractPageAuto:(NSInteger)page optionsJson:(nullable NSString*)optionsJson error:(NSError**)error;
Extrai automaticamente uma página com um blob de opções JSON.
- (nullable NSString*)classifyPage:(NSInteger)page error:(NSError**)error;
- (nullable NSString*)classifyDocumentWithError:(NSError**)error;
Classifica uma única página ou o documento inteiro (retorna um JSON de classificação).
Remoção de Cabeçalho / Rodapé / Artefatos
- (int32_t)eraseHeader:(NSInteger)page error:(NSError**)error;
- (int32_t)eraseFooter:(NSInteger)page error:(NSError**)error;
- (int32_t)eraseArtifacts:(NSInteger)page error:(NSError**)error;
Apaga o cabeçalho, o rodapé ou os artefatos de uma única página; retorna a quantidade removida.
- (int32_t)removeHeaders:(float)threshold error:(NSError**)error;
- (int32_t)removeFooters:(float)threshold error:(NSError**)error;
- (int32_t)removeArtifacts:(float)threshold error:(NSError**)error;
Remove cabeçalhos, rodapés ou artefatos repetidos em todo o documento, acima de um threshold (limiar) de similaridade.
Formulários
- (nullable NSArray<POXFormField*>*)formFieldsWithError:(NSError**)error;
Obtém todos os campos AcroForm.
- (nullable NSData*)exportFormDataToBytes:(int32_t)formatType error:(NSError**)error;
Exporta os dados do formulário como bytes FDF/XFDF (formatType seleciona o formato).
- (BOOL)importFormDataFromPath:(NSString*)dataPath error:(NSError**)error;
- (BOOL)importFormFromFile:(NSString*)filename error:(NSError**)error;
Importa dados de formulário a partir de um arquivo FDF/XFDF.
Estrutura & Metadados
- (nullable NSString*)outlineWithError:(NSError**)error;
- (nullable NSString*)pageLabelsWithError:(NSError**)error;
- (nullable NSString*)xmpMetadataWithError:(NSError**)error;
Obtém o sumário do documento (bookmarks), os intervalos de rótulos de página e os metadados XMP como JSON.
- (nullable NSData*)sourceBytesWithError:(NSError**)error;
Obtém os bytes brutos do PDF de origem.
- (nullable NSString*)planSplitByBookmarks:(nullable NSString*)optionsJson error:(NSError**)error;
Calcula um plano de divisão agrupando páginas pelos bookmarks de nível superior (retorna JSON).
Anotações / Fontes / Busca como JSON
- (nullable NSString*)annotationsJson:(NSInteger)page error:(NSError**)error;
- (nullable NSString*)embeddedFontsJson:(NSInteger)page error:(NSError**)error;
- (nullable NSString*)searchJson:(NSInteger)page term:(NSString*)term caseSensitive:(BOOL)caseSensitive error:(NSError**)error;
Variantes serializadas em JSON das anotações de página, fontes incorporadas e busca por página.
Geometria & Elementos de Página
- (float)pageWidth:(NSInteger)pageIndex error:(NSError**)error;
- (float)pageHeight:(NSInteger)pageIndex error:(NSError**)error;
- (int32_t)pageRotation:(NSInteger)pageIndex error:(NSError**)error;
Largura, altura e rotação (em graus) da página (-1 em caso de erro).
- (nullable POXElementList*)pageElements:(NSInteger)pageIndex error:(NSError**)error;
Obtém a lista de elementos de layout de uma página. Veja POXElementList.
- (POXPage*)pageAtIndex:(NSInteger)index;
Obtém um handle de página vinculado a este documento. Veja POXPage.
Renderização
- (nullable POXRenderedImage*)renderPage:(NSInteger)pageIndex format:(int32_t)format error:(NSError**)error;
Renderiza uma página como imagem (format 0 = PNG, 1 = JPEG).
- (nullable POXRenderedImage*)renderPageZoom:(NSInteger)pageIndex zoom:(float)zoom format:(int32_t)format error:(NSError**)error;
- (nullable POXRenderedImage*)renderPageThumbnail:(NSInteger)pageIndex size:(int32_t)size format:(int32_t)format error:(NSError**)error;
Renderiza uma página com um fator de zoom, ou como miniatura com um size alvo para o maior lado.
- (nullable POXRenderedImage*)renderPageWithOptions:(NSInteger)pageIndex
dpi:(int32_t)dpi
format:(int32_t)format
bgR:(float)bgR bgG:(float)bgG bgB:(float)bgB bgA:(float)bgA
transparentBackground:(int32_t)transparentBackground
renderAnnotations:(int32_t)renderAnnotations
jpegQuality:(int32_t)jpegQuality
error:(NSError**)error;
Renderiza com a superfície completa de opções (DPI, fundo RGBA, transparência, flag de anotações, qualidade JPEG).
- (nullable POXRenderedImage*)renderPageWithOptionsEx:(NSInteger)pageIndex
dpi:(int32_t)dpi
format:(int32_t)format
bgR:(float)bgR bgG:(float)bgG bgB:(float)bgB bgA:(float)bgA
transparentBackground:(int32_t)transparentBackground
renderAnnotations:(int32_t)renderAnnotations
jpegQuality:(int32_t)jpegQuality
excludedLayers:(NSArray<NSString*>*)excludedLayers
error:(NSError**)error;
Igual a renderPageWithOptions:, mas suprimindo adicionalmente as camadas OCG nomeadas.
- (nullable POXRenderedImage*)renderPageRegion:(NSInteger)pageIndex cropX:(float)cropX cropY:(float)cropY cropWidth:(float)cropWidth cropHeight:(float)cropHeight format:(int32_t)format error:(NSError**)error;
Renderiza uma região retangular de uma página (pontos do espaço do usuário, origem no canto inferior esquerdo).
- (nullable POXRenderedImage*)renderPageFit:(NSInteger)pageIndex w:(int32_t)w h:(int32_t)h format:(int32_t)format error:(NSError**)error;
Renderiza uma página para caber dentro de w × h pixels, preservando a proporção.
- (nullable POXRenderedImage*)renderPageRaw:(NSInteger)pageIndex dpi:(int32_t)dpi outWidth:(int32_t*)outWidth outHeight:(int32_t*)outHeight error:(NSError**)error;
Renderiza uma página em um buffer RGBA8888 bruto; os parâmetros de saída recebem as dimensões em pixels.
- (int32_t)estimateRenderTime:(NSInteger)pageIndex error:(NSError**)error;
Estima o tempo de renderização (em unidades do engine) de uma página, ou -1 em caso de erro.
OCR
- (BOOL)pageNeedsOcr:(NSInteger)pageIndex error:(NSError**)error;
Indica se uma página não tem texto extraível e se beneficiaria de OCR.
- (nullable NSString*)ocrExtractText:(NSInteger)pageIndex engine:(nullable POXOcrEngine*)engine error:(NSError**)error;
Extrai texto usando OCR; passe nil para usar apenas texto nativo. Veja POXOcrEngine.
Validação de Conformidade
- (nullable POXPdfAResults*)validatePdfA:(int32_t)level error:(NSError**)error;
- (nullable POXUaResults*)validatePdfUa:(int32_t)level error:(NSError**)error;
- (nullable POXPdfXResults*)validatePdfX:(int32_t)level error:(NSError**)error;
Valida conformidade com PDF/A, PDF/UA ou PDF/X; level seleciona o subnível. Retorna um handle de resultado.
- (BOOL)convertToPdfA:(int32_t)level error:(NSError**)error;
Converte o documento para PDF/A no nível de conformidade indicado.
Assinaturas (Nível de Documento)
- (BOOL)sign:(POXCertificate*)certificate reason:(nullable NSString*)reason location:(nullable NSString*)location error:(NSError**)error;
Aplica uma assinatura digital básica com um certificado carregado.
- (int32_t)signatureCountWithError:(NSError**)error;
- (nullable POXSignatureInfo*)signatureAtIndex:(int32_t)index error:(NSError**)error;
- (int32_t)verifyAllSignaturesWithError:(NSError**)error;
- (int32_t)hasTimestampWithError:(NSError**)error;
- (nullable POXDss*)dssWithError:(NSError**)error;
Conta assinaturas, obtém informações de assinatura, verifica todas as assinaturas, checa a presença de um timestamp do documento e lê o Document Security Store.
Ciclo de Vida
- (void)close;
Libera o handle nativo imediatamente (idempotente).
POXPage
Um handle de página vinculado a um POXDocument (baseado em zero). Mantém uma referência forte ao seu documento, de modo que não pode sobreviver a ele.
- (nullable NSString*)text:(NSError**)error;
- (nullable NSString*)markdown:(NSError**)error;
- (nullable NSString*)html:(NSError**)error;
- (nullable NSString*)plainText:(NSError**)error;
Extrai o texto, Markdown, HTML ou o texto puro com preservação de layout desta página.
POXPdf
Um PDF produzido por um builder ou por uma factory de empacotamento (wrapping).
Construtores
+ (nullable instancetype)fromMarkdown:(NSString*)markdown error:(NSError**)error;
+ (nullable instancetype)fromHtml:(NSString*)html error:(NSError**)error;
+ (nullable instancetype)fromText:(NSString*)text error:(NSError**)error;
Cria um PDF a partir de Markdown, HTML ou texto puro.
+ (nullable instancetype)fromImage:(NSString*)path error:(NSError**)error;
+ (nullable instancetype)fromImageBytes:(NSData*)data error:(NSError**)error;
Cria um PDF de uma única página empacotando um arquivo de imagem ou bytes de imagem em memória.
+ (nullable instancetype)fromHtml:(NSString*)html css:(NSString*)css fontBytes:(nullable NSData*)fontBytes error:(NSError**)error;
Cria um PDF a partir de HTML + CSS com uma única fonte incorporada opcional.
+ (nullable instancetype)fromHtml:(NSString*)html css:(NSString*)css families:(NSArray<NSString*>*)families fonts:(NSArray<NSData*>*)fonts error:(NSError**)error;
Cria um PDF a partir de HTML + CSS com um cascading de múltiplas fontes (arrays paralelos families/fonts).
Métodos
- (BOOL)saveToPath:(NSString*)path error:(NSError**)error;
- (nullable NSData*)toBytesWithError:(NSError**)error;
- (NSInteger)pageCountError:(NSError**)error;
- (void)close;
Salva em um caminho, obtém os bytes do PDF, obtém a contagem de páginas (-1 em caso de erro), ou libera o handle nativo.
POXDocumentEditor
Um PDF aberto para edição in-place. Operações com código de status reportam falhas como NSError; consultas is* retornam BOOL.
Abertura
+ (nullable instancetype)openEditor:(NSString*)path error:(NSError**)error;
+ (nullable instancetype)openFromBytes:(NSData*)data error:(NSError**)error;
Abre um PDF para edição a partir de um caminho ou de bytes em memória.
Estado & Metadados
- (NSInteger)pageCountError:(NSError**)error;
- (POXVersion)version;
- (BOOL)isModified;
- (nullable NSString*)sourcePathError:(NSError**)error;
Contagem de páginas, versão do PDF, flag de modificação pendente, e o caminho de origem do editor.
- (nullable NSString*)producerError:(NSError**)error;
- (BOOL)setProducer:(NSString*)value error:(NSError**)error;
- (nullable NSString*)creationDateError:(NSError**)error;
- (BOOL)setCreationDate:(NSString*)date error:(NSError**)error;
Obtém/define /Info.Producer e /Info.CreationDate do documento.
Operações de Página
- (BOOL)deletePage:(NSInteger)page error:(NSError**)error;
- (BOOL)movePageFrom:(NSInteger)from to:(NSInteger)to error:(NSError**)error;
Exclui ou reordena páginas.
- (BOOL)rotatePage:(NSInteger)page byDegrees:(NSInteger)degrees error:(NSError**)error;
- (BOOL)rotateAllPages:(NSInteger)degrees error:(NSError**)error;
- (BOOL)setPageRotation:(NSInteger)page degrees:(NSInteger)degrees error:(NSError**)error;
- (NSInteger)pageRotation:(NSInteger)page error:(NSError**)error;
Gira uma página, todas as páginas, define a rotação absoluta, ou lê a rotação atual.
- (BOOL)cropMarginsLeft:(float)left right:(float)right top:(float)top bottom:(float)bottom error:(NSError**)error;
Recorta todas as páginas pelas margens informadas.
- (POXBbox)pageCropBox:(NSInteger)page error:(NSError**)error;
- (BOOL)setPageCropBox:(NSInteger)page box:(POXBbox)box error:(NSError**)error;
- (POXBbox)pageMediaBox:(NSInteger)page error:(NSError**)error;
- (BOOL)setPageMediaBox:(NSInteger)page box:(POXBbox)box error:(NSError**)error;
Obtém/define a CropBox e a MediaBox de uma página.
Redação
- (BOOL)applyAllRedactions:(NSError**)error;
- (BOOL)applyPageRedactions:(NSInteger)page error:(NSError**)error;
- (BOOL)isPageMarkedForRedaction:(NSInteger)page;
- (BOOL)unmarkPageForRedaction:(NSInteger)page error:(NSError**)error;
Aplica redações enfileiradas (todas ou por página), consulta e remove a marcação de redação.
- (BOOL)redactionAddPage:(NSInteger)page x1:(double)x1 y1:(double)y1 x2:(double)x2 y2:(double)y2 r:(double)r g:(double)g b:(double)b error:(NSError**)error;
- (int32_t)redactionCount:(NSInteger)page error:(NSError**)error;
- (int32_t)redactionApplyScrubMetadata:(BOOL)scrubMetadata r:(double)r g:(double)g b:(double)b error:(NSError**)error;
- (int32_t)redactionScrubMetadataWithError:(NSError**)error;
Redação geométrica: enfileira um retângulo de preenchimento, conta os retângulos enfileirados, aplica destrutivamente (retornando os glifos removidos), e faz a limpeza independente de metadados/JS/arquivos incorporados.
Apagamento de Regiões
- (BOOL)eraseRegion:(NSInteger)page x:(float)x y:(float)y w:(float)w h:(float)h error:(NSError**)error;
- (BOOL)eraseRegions:(NSInteger)page rects:(NSArray<NSValue*>*)rects error:(NSError**)error;
- (BOOL)clearEraseRegions:(NSInteger)page error:(NSError**)error;
Apaga um único retângulo, múltiplos retângulos do tipo POXBbox, ou limpa os apagamentos pendentes.
Achatamento (Flattening)
- (BOOL)flattenForms:(NSError**)error;
- (BOOL)flattenFormsOnPage:(NSInteger)page error:(NSError**)error;
- (BOOL)flattenAnnotations:(NSInteger)page error:(NSError**)error;
- (BOOL)flattenAllAnnotations:(NSError**)error;
Achata todos os formulários, formulários de uma página, anotações de uma página, ou todas as anotações.
- (NSInteger)flattenWarningsCount;
- (nullable NSString*)flattenWarning:(NSInteger)index error:(NSError**)error;
- (BOOL)isPageMarkedForFlatten:(NSInteger)page;
- (BOOL)unmarkPageForFlatten:(NSInteger)page error:(NSError**)error;
Inspeciona os avisos de achatamento e a marcação de achatamento por página.
Formulários
- (BOOL)setFormField:(NSString*)name value:(NSString*)value error:(NSError**)error;
- (BOOL)importFdfBytes:(NSData*)data error:(NSError**)error;
- (BOOL)importXfdfBytes:(NSData*)data error:(NSError**)error;
Define o valor de um campo de formulário pelo nome; importa bytes FDF / XFDF brutos.
Mesclagem / Conversão / Incorporação
- (BOOL)mergeFrom:(NSString*)sourcePath error:(NSError**)error;
- (BOOL)mergeFromBytes:(NSData*)data error:(NSError**)error;
- (BOOL)convertToPdfA:(NSInteger)level error:(NSError**)error;
- (BOOL)embedFile:(NSString*)name data:(NSData*)data error:(NSError**)error;
- (nullable NSData*)extractPagesToBytes:(NSArray<NSNumber*>*)pages error:(NSError**)error;
Mescla outro PDF (caminho ou bytes), converte para PDF/A in place, anexa um arquivo incorporado, ou extrai um subconjunto de páginas para um novo PDF em memória.
Códigos de Barras
- (BOOL)addBarcode:(POXBarcode*)barcode page:(NSInteger)page x:(float)x y:(float)y width:(float)width height:(float)height error:(NSError**)error;
Posiciona um código de barras gerado em uma página. Veja POXBarcode.
Salvamento
- (BOOL)saveToPath:(NSString*)path error:(NSError**)error;
- (nullable NSData*)saveToBytesWithError:(NSError**)error;
- (nullable NSData*)saveToBytesCompress:(BOOL)compress garbageCollect:(BOOL)garbageCollect linearize:(BOOL)linearize error:(NSError**)error;
- (BOOL)saveEncryptedToPath:(NSString*)path userPassword:(NSString*)userPassword ownerPassword:(NSString*)ownerPassword error:(NSError**)error;
- (nullable NSData*)saveEncryptedToBytesWithUserPassword:(NSString*)userPassword ownerPassword:(NSString*)ownerPassword error:(NSError**)error;
- (void)close;
Salva em um caminho ou em bytes (com compressão/GC/linearização opcionais), salva criptografado com AES em um caminho ou em bytes, ou libera o handle nativo.
POXDocumentBuilder
Um builder fluente que constrói um PDF totalmente novo.
+ (nullable instancetype)createWithError:(NSError**)error;
Cria um novo builder de documento, vazio.
Metadados
- (BOOL)setTitle:(NSString*)title error:(NSError**)error;
- (BOOL)setAuthor:(NSString*)author error:(NSError**)error;
- (BOOL)setSubject:(NSString*)subject error:(NSError**)error;
- (BOOL)setKeywords:(NSString*)keywords error:(NSError**)error;
- (BOOL)setCreator:(NSString*)creator error:(NSError**)error;
- (BOOL)onOpen:(NSString*)script error:(NSError**)error;
Define os metadados do documento e uma ação JavaScript de abertura em nível de documento.
PDF Tagged / Acessível
- (BOOL)taggedPdfUa1:(NSError**)error;
- (BOOL)language:(NSString*)lang error:(NSError**)error;
- (BOOL)roleMapCustom:(NSString*)custom standard:(NSString*)standard error:(NSError**)error;
Habilita a marcação PDF/UA-1, define o idioma do documento, e adiciona uma entrada de mapeamento de papel (role map) personalizado para padrão.
Fontes
- (BOOL)registerEmbeddedFont:(NSString*)name font:(POXEmbeddedFont*)font error:(NSError**)error;
Registra uma fonte TTF/OTF sob name (transfere a posse do handle nativo da fonte). Veja POXEmbeddedFont.
Páginas
- (nullable POXPageBuilder*)a4PageWithError:(NSError**)error;
- (nullable POXPageBuilder*)letterPageWithError:(NSError**)error;
- (nullable POXPageBuilder*)pageWithWidth:(float)width height:(float)height error:(NSError**)error;
Inicia uma página A4, US-Letter, ou de tamanho personalizado. Veja POXPageBuilder.
Build / Salvar
- (nullable NSData*)buildWithError:(NSError**)error;
- (BOOL)saveToPath:(NSString*)path error:(NSError**)error;
- (BOOL)saveEncryptedToPath:(NSString*)path userPassword:(NSString*)userPassword ownerPassword:(NSString*)ownerPassword error:(NSError**)error;
- (nullable NSData*)toBytesEncryptedWithUserPassword:(NSString*)userPassword ownerPassword:(NSString*)ownerPassword error:(NSError**)error;
- (void)close;
Constrói os bytes do PDF, salva em um caminho, salva criptografado com AES em um caminho ou em bytes, ou libera o handle nativo.
POXPageBuilder
Uma página sendo construída dentro de um POXDocumentBuilder. A maioria das operações retorna BOOL e encadeia através do pai. Chame -done: para confirmar a página ou -close para descartá-la.
Layout de Texto
- (BOOL)font:(NSString*)name size:(float)size error:(NSError**)error;
- (BOOL)at:(float)x y:(float)y error:(NSError**)error;
- (BOOL)text:(NSString*)text error:(NSError**)error;
- (BOOL)heading:(uint8_t)level text:(NSString*)text error:(NSError**)error;
- (BOOL)paragraph:(NSString*)text error:(NSError**)error;
- (BOOL)space:(float)points error:(NSError**)error;
- (BOOL)horizontalRule:(NSError**)error;
- (BOOL)newline:(NSError**)error;
- (BOOL)newPageSameSize:(NSError**)error;
Define a fonte, a posição do cursor, e emite texto, títulos, parágrafos, espaço vertical, uma linha horizontal, uma quebra de linha, ou uma nova página do mesmo tamanho.
- (BOOL)textInRectX:(float)x y:(float)y w:(float)w h:(float)h text:(NSString*)text align:(int32_t)align error:(NSError**)error;
Posiciona texto com quebra de linha e alinhamento dentro de um retângulo.
Trechos Inline (Inline Runs)
- (BOOL)inlineText:(NSString*)text error:(NSError**)error;
- (BOOL)inlineBold:(NSString*)text error:(NSError**)error;
- (BOOL)inlineItalic:(NSString*)text error:(NSError**)error;
- (BOOL)inlineColorR:(float)r g:(float)g b:(float)b text:(NSString*)text error:(NSError**)error;
Acrescenta trechos de texto inline (puro, negrito, itálico ou colorido em RGB).
Notas de Rodapé / Colunas
- (BOOL)footnoteRefMark:(NSString*)refMark noteText:(NSString*)noteText error:(NSError**)error;
- (BOOL)columnsCount:(uint32_t)columnCount gapPt:(float)gapPt text:(NSString*)text error:(NSError**)error;
Adiciona uma referência de nota de rodapé + nota, ou flui o texto em múltiplas colunas.
Links & Ações
- (BOOL)linkUrl:(NSString*)url error:(NSError**)error;
- (BOOL)linkPage:(NSInteger)page error:(NSError**)error;
- (BOOL)linkNamed:(NSString*)destination error:(NSError**)error;
- (BOOL)linkJavascript:(NSString*)script error:(NSError**)error;
- (BOOL)onOpen:(NSString*)script error:(NSError**)error;
- (BOOL)onClose:(NSString*)script error:(NSError**)error;
Adiciona links de URL / página / destino nomeado / JavaScript, e ações de abertura/fechamento de página.
Ações JS de Campo de Formulário
- (BOOL)fieldKeystroke:(NSString*)script error:(NSError**)error;
- (BOOL)fieldFormat:(NSString*)script error:(NSError**)error;
- (BOOL)fieldValidate:(NSString*)script error:(NSError**)error;
- (BOOL)fieldCalculate:(NSString*)script error:(NSError**)error;
Anexa JavaScript de keystroke / formatação / validação / cálculo ao campo adicionado mais recentemente.
Decorações de Texto
- (BOOL)highlightR:(float)r g:(float)g b:(float)b error:(NSError**)error;
- (BOOL)underlineR:(float)r g:(float)g b:(float)b error:(NSError**)error;
- (BOOL)strikeoutR:(float)r g:(float)g b:(float)b error:(NSError**)error;
- (BOOL)squigglyR:(float)r g:(float)g b:(float)b error:(NSError**)error;
Aplica destaque, sublinhado, tachado, ou decoração ondulada (squiggly) ao elemento de texto anterior.
Anotações
- (BOOL)stickyNote:(NSString*)text error:(NSError**)error;
- (BOOL)stickyNoteAt:(float)x y:(float)y text:(NSString*)text error:(NSError**)error;
- (BOOL)watermark:(NSString*)text error:(NSError**)error;
- (BOOL)watermarkConfidential:(NSError**)error;
- (BOOL)watermarkDraft:(NSError**)error;
- (BOOL)stamp:(NSString*)typeName error:(NSError**)error;
- (BOOL)freetextAtX:(float)x y:(float)y w:(float)w h:(float)h text:(NSString*)text error:(NSError**)error;
Adiciona notas adesivas, marcas d’água (personalizada / CONFIDENTIAL / DRAFT), um carimbo nomeado, e anotações de texto livre.
Campos de Formulário
- (BOOL)textFieldName:(NSString*)name x:(float)x y:(float)y w:(float)w h:(float)h defaultValue:(nullable NSString*)defaultValue error:(NSError**)error;
- (BOOL)checkboxName:(NSString*)name x:(float)x y:(float)y w:(float)w h:(float)h checked:(BOOL)checked error:(NSError**)error;
- (BOOL)comboBoxName:(NSString*)name x:(float)x y:(float)y w:(float)w h:(float)h options:(NSArray<NSString*>*)options selected:(nullable NSString*)selected error:(NSError**)error;
- (BOOL)radioGroupName:(NSString*)name values:(NSArray<NSString*>*)values xs:(NSArray<NSNumber*>*)xs ys:(NSArray<NSNumber*>*)ys ws:(NSArray<NSNumber*>*)ws hs:(NSArray<NSNumber*>*)hs selected:(nullable NSString*)selected error:(NSError**)error;
- (BOOL)pushButtonName:(NSString*)name x:(float)x y:(float)y w:(float)w h:(float)h caption:(NSString*)caption error:(NSError**)error;
- (BOOL)signatureFieldName:(NSString*)name x:(float)x y:(float)y w:(float)w h:(float)h error:(NSError**)error;
Adiciona campos de texto, caixas de seleção, caixas de combinação, grupos de rádio, botões, e campos de assinatura.
Códigos de Barras
- (BOOL)barcode1d:(int32_t)barcodeType data:(NSString*)data x:(float)x y:(float)y w:(float)w h:(float)h error:(NSError**)error;
- (BOOL)barcodeQrData:(NSString*)data x:(float)x y:(float)y size:(float)size error:(NSError**)error;
Desenha um código de barras 1D ou um código QR diretamente na página.
Imagens
- (BOOL)image:(NSData*)bytes x:(float)x y:(float)y w:(float)w h:(float)h error:(NSError**)error;
- (BOOL)imageWithAlt:(NSData*)bytes x:(float)x y:(float)y w:(float)w h:(float)h altText:(NSString*)altText error:(NSError**)error;
- (BOOL)imageArtifact:(NSData*)bytes x:(float)x y:(float)y w:(float)w h:(float)h error:(NSError**)error;
Posiciona uma imagem, uma imagem com texto alternativo de acessibilidade, ou uma imagem de artefato (decorativa).
Gráficos Vetoriais
- (BOOL)rectX:(float)x y:(float)y w:(float)w h:(float)h error:(NSError**)error;
- (BOOL)filledRectX:(float)x y:(float)y w:(float)w h:(float)h r:(float)r g:(float)g b:(float)b error:(NSError**)error;
- (BOOL)lineX1:(float)x1 y1:(float)y1 x2:(float)x2 y2:(float)y2 error:(NSError**)error;
- (BOOL)strokeRectX:(float)x y:(float)y w:(float)w h:(float)h width:(float)width r:(float)r g:(float)g b:(float)b error:(NSError**)error;
- (BOOL)strokeLineX1:(float)x1 y1:(float)y1 x2:(float)x2 y2:(float)y2 width:(float)width r:(float)r g:(float)g b:(float)b error:(NSError**)error;
- (BOOL)strokeRectDashedX:(float)x y:(float)y w:(float)w h:(float)h width:(float)width r:(float)r g:(float)g b:(float)b dashArray:(NSArray<NSNumber*>*)dashArray phase:(float)phase error:(NSError**)error;
- (BOOL)strokeLineDashedX1:(float)x1 y1:(float)y1 x2:(float)x2 y2:(float)y2 width:(float)width r:(float)r g:(float)g b:(float)b dashArray:(NSArray<NSNumber*>*)dashArray phase:(float)phase error:(NSError**)error;
Desenha retângulos (contorno / preenchido / com traço / tracejado) e linhas (simples / com traço / tracejada).
Tabelas
- (BOOL)tableColumns:(NSArray<NSNumber*>*)widths aligns:(NSArray<NSNumber*>*)aligns rows:(NSArray<NSArray<NSString*>*>*)rows hasHeader:(BOOL)hasHeader error:(NSError**)error;
Renderiza uma tabela completa com larguras de coluna, alinhamentos e linhas.
Tabelas em Streaming
- (BOOL)streamingTableBeginHeaders:(NSArray<NSString*>*)headers widths:(NSArray<NSNumber*>*)widths aligns:(NSArray<NSNumber*>*)aligns repeatHeader:(BOOL)repeatHeader error:(NSError**)error;
- (BOOL)streamingTableBeginV2Headers:(NSArray<NSString*>*)headers widths:(NSArray<NSNumber*>*)widths aligns:(NSArray<NSNumber*>*)aligns repeatHeader:(BOOL)repeatHeader mode:(int32_t)mode sampleRows:(NSInteger)sampleRows minColWidthPt:(float)minColWidthPt maxColWidthPt:(float)maxColWidthPt maxRowspan:(NSInteger)maxRowspan error:(NSError**)error;
- (BOOL)streamingTableSetBatchSize:(NSInteger)batchSize error:(NSError**)error;
- (NSInteger)streamingTablePendingRowCount;
- (NSInteger)streamingTableBatchCount;
- (BOOL)streamingTableFlush:(NSError**)error;
- (BOOL)streamingTablePushRow:(NSArray<NSString*>*)cells error:(NSError**)error;
- (BOOL)streamingTablePushRowV2:(NSArray<NSString*>*)cells rowspans:(nullable NSArray<NSNumber*>*)rowspans error:(NSError**)error;
- (BOOL)streamingTableFinish:(NSError**)error;
Inicia uma tabela em streaming (básica ou com layout automático V2), ajusta o tamanho do lote, empurra linhas (com rowspans opcionais), descarrega (flush) e finaliza — para tabelas grandes demais para materializar de uma só vez.
Confirmação (Commit)
- (BOOL)done:(NSError**)error;
- (void)close;
Confirma a página em seu builder pai, ou a descarta.
POXEmbeddedFont
Uma fonte TTF/OTF carregada para incorporação. A posse é transferida para o builder após um registerEmbeddedFont:font: bem-sucedido.
+ (nullable instancetype)fromPath:(NSString*)path error:(NSError**)error;
+ (nullable instancetype)fromBytes:(NSData*)data name:(nullable NSString*)name error:(NSError**)error;
- (void)close;
Carrega uma fonte a partir de um caminho ou de bytes (name pode ser nil para usar o nome PostScript), ou libera o handle nativo.
POXBarcode
Uma imagem de código de barras / código QR gerada.
+ (nullable instancetype)generateQrCode:(NSString*)data errorCorrection:(int32_t)errorCorrection sizePx:(int32_t)sizePx error:(NSError**)error;
+ (nullable instancetype)generateBarcode:(NSString*)data format:(int32_t)format sizePx:(int32_t)sizePx error:(NSError**)error;
Gera um código QR (com nível de correção de erro) ou um código de barras 1D/2D em um format informado.
- (nullable NSString*)dataError:(NSError**)error;
- (int32_t)formatError:(NSError**)error;
- (float)confidenceError:(NSError**)error;
- (nullable NSData*)imagePngWithSizePx:(int32_t)sizePx error:(NSError**)error;
- (nullable NSString*)svgWithSizePx:(int32_t)sizePx error:(NSError**)error;
- (void)close;
Lê o payload, o código de formato, e a confiança de decodificação; codifica como bytes PNG ou como string SVG; ou libera o handle nativo.
POXOcrEngine
Um engine de OCR baseado em arquivos de modelo de detecção/reconhecimento/dicionário.
+ (nullable instancetype)createWithDetModelPath:(NSString*)detModelPath recModelPath:(NSString*)recModelPath dictPath:(NSString*)dictPath error:(NSError**)error;
- (nullable void*)POX_engineHandle;
- (void)close;
Cria um engine a partir de caminhos de modelo + dicionário, expõe o handle bruto do engine para ocrExtractText:engine:error:, ou libera o handle nativo.
POXElementList
Uma lista de elementos de layout de uma página.
- (int32_t)count;
- (nullable NSString*)typeAtIndex:(int32_t)index error:(NSError**)error;
- (nullable NSString*)textAtIndex:(int32_t)index error:(NSError**)error;
- (POXBbox)rectAtIndex:(int32_t)index error:(NSError**)error;
- (nullable NSString*)toJsonWithError:(NSError**)error;
- (void)close;
Conta os elementos; lê o tipo, o texto e a bounding box de cada elemento; serializa a lista inteira como JSON; ou libera o handle nativo.
POXRenderer
Um handle de renderizador independente (não vinculado a um documento).
+ (nullable instancetype)createWithDpi:(int32_t)dpi format:(int32_t)format quality:(int32_t)quality antiAlias:(BOOL)antiAlias error:(NSError**)error;
- (void)close;
Cria um renderizador configurado (DPI, formato, qualidade, anti-aliasing), ou libera o handle nativo.
Assinaturas Digitais & PKI
POXCertificate
Um certificado de assinatura / verificação carregado.
+ (nullable instancetype)loadFromBytes:(NSData*)data password:(NSString*)password error:(NSError**)error;
+ (nullable instancetype)loadFromPemCert:(NSString*)certPem keyPem:(NSString*)keyPem error:(NSError**)error;
Carrega credenciais a partir de bytes PKCS#12 + senha, ou a partir de certificado PEM + chave privada.
- (nullable NSString*)subjectError:(NSError**)error;
- (nullable NSString*)issuerError:(NSError**)error;
- (nullable NSString*)serialError:(NSError**)error;
- (BOOL)validityNotBefore:(int64_t*)notBefore notAfter:(int64_t*)notAfter error:(NSError**)error;
- (int32_t)isValidError:(NSError**)error;
- (void)close;
Lê o subject / issuer / serial, a janela de validade (segundos desde o epoch Unix), a validade atual (1/0/-1), ou libera o handle nativo.
POXSignatureInfo
Informações sobre uma assinatura lida de um documento.
- (nullable NSString*)signerNameError:(NSError**)error;
- (nullable NSString*)signingReasonError:(NSError**)error;
- (nullable NSString*)signingLocationError:(NSError**)error;
- (int64_t)signingTimeError:(NSError**)error;
- (nullable POXCertificate*)certificateError:(NSError**)error;
- (int32_t)padesLevelError:(NSError**)error;
- (BOOL)hasTimestampError:(NSError**)error;
- (nullable POXTimestamp*)timestampError:(NSError**)error;
- (BOOL)addTimestamp:(POXTimestamp*)timestamp error:(NSError**)error;
- (int32_t)verifyError:(NSError**)error;
- (int32_t)verifyDetached:(NSData*)pdf error:(NSError**)error;
- (void)close;
Lê o assinante/motivo/local/hora, o certificado do assinante, o nível baseline PAdES, e o timestamp; anexa um timestamp; verifica criptograficamente (verifyError:) ou verifica de ponta a ponta contra os bytes completos do PDF (verifyDetached:).
POXTimestamp
Um token de timestamp RFC 3161 já analisado (parsed).
+ (nullable instancetype)parse:(NSData*)data error:(NSError**)error;
- (nullable NSData*)tokenError:(NSError**)error;
- (nullable NSData*)messageImprintError:(NSError**)error;
- (int64_t)timeError:(NSError**)error;
- (nullable NSString*)serialError:(NSError**)error;
- (nullable NSString*)tsaNameError:(NSError**)error;
- (nullable NSString*)policyOidError:(NSError**)error;
- (int32_t)hashAlgorithmError:(NSError**)error;
- (BOOL)verifyError:(NSError**)error;
- (void)close;
Analisa um token DER; lê os bytes brutos do token, o message imprint, a hora, o serial, o nome da TSA, o OID da política, e o algoritmo de hash; verifica; ou libera o handle nativo.
POXTsaClient
Um cliente TSA (RFC 3161).
+ (nullable instancetype)createWithUrl:(NSString*)url username:(nullable NSString*)username password:(nullable NSString*)password timeout:(int32_t)timeout hashAlgo:(int32_t)hashAlgo useNonce:(BOOL)useNonce certReq:(BOOL)certReq error:(NSError**)error;
- (nullable POXTimestamp*)requestTimestamp:(NSData*)data error:(NSError**)error;
- (nullable POXTimestamp*)requestTimestampHash:(NSData*)hash hashAlgo:(int32_t)hashAlgo error:(NSError**)error;
- (void)close;
Cria um cliente, solicita um timestamp sobre os dados ou sobre um hash pré-calculado, ou libera o handle nativo.
POXDss
Um Document Security Store lido de um documento.
- (int32_t)certCount;
- (int32_t)crlCount;
- (int32_t)ocspCount;
- (int32_t)vriCount;
- (nullable NSData*)certAtIndex:(int32_t)index error:(NSError**)error;
- (nullable NSData*)crlAtIndex:(int32_t)index error:(NSError**)error;
- (nullable NSData*)ocspAtIndex:(int32_t)index error:(NSError**)error;
- (void)close;
Conta e lê os certificados DER, as CRLs, e as respostas OCSP (além da contagem de VRI) no DSS.
POXSigning
Pontos de entrada de assinatura de nível superior e configuração de log da biblioteca (métodos de classe).
+ (nullable NSData*)signBytes:(NSData*)pdf certificate:(POXCertificate*)certificate reason:(nullable NSString*)reason location:(nullable NSString*)location error:(NSError**)error;
Assina bytes de PDF brutos com uma assinatura básica (não PAdES).
+ (nullable NSData*)signBytesPades:(NSData*)pdf certificate:(POXCertificate*)certificate level:(int32_t)level tsaUrl:(nullable NSString*)tsaUrl reason:(nullable NSString*)reason location:(nullable NSString*)location certs:(NSArray<NSData*>*)certs crls:(NSArray<NSData*>*)crls ocsps:(NSArray<NSData*>*)ocsps error:(NSError**)error;
Assina bytes de PDF brutos em um nível baseline PAdES com material de revogação.
+ (nullable NSData*)signBytesPadesOpts:(NSData*)pdf options:(POXPadesSignOptions*)options error:(NSError**)error;
Assina bytes de PDF brutos usando um objeto de configuração POXPadesSignOptions.
+ (void)setLogLevel:(int32_t)level;
+ (int32_t)logLevel;
Define / obtém o nível de log global (0=Off … 5=Trace).
POXPadesSignOptions
Opções de assinatura PAdES (variante de ponteiro de struct). Todos os campos são properties:
| Property | Tipo | Descrição |
|---|---|---|
certificate |
POXCertificate* |
Certificado de assinatura |
level |
int32_t |
Baseline PAdES (0=B-B, 1=B-T, 2=B-LT) |
tsaUrl |
NSString* |
URL da TSA (anulável) |
reason |
NSString* |
Motivo da assinatura (anulável) |
location |
NSString* |
Local da assinatura (anulável) |
certs / crls / ocsps |
NSArray<NSData*>* |
Material de revogação codificado em DER (B-LT) |
Tipos de Resultado de Conformidade
POXPdfAResults
- (BOOL)isCompliantError:(NSError**)error;
- (int32_t)errorCount;
- (int32_t)warningCount;
- (NSArray<NSString*>*)errors;
- (void)close;
Resultado da validação PDF/A: flag de conformidade, contagens de erro/aviso, mensagens de erro.
POXUaResults
- (BOOL)isAccessibleError:(NSError**)error;
- (int32_t)errorCount;
- (int32_t)warningCount;
- (NSArray<NSString*>*)errors;
- (NSArray<NSString*>*)warnings;
- (BOOL)stats:(POXUaStats*)stats error:(NSError**)error;
- (void)close;
Resultado de acessibilidade PDF/UA: flag de acessibilidade, contagens e mensagens de erro/aviso, e uma struct POXUaStats com contagem de elementos.
POXPdfXResults
- (BOOL)isCompliantError:(NSError**)error;
- (int32_t)errorCount;
- (NSArray<NSString*>*)errors;
- (void)close;
Resultado da validação PDF/X: flag de conformidade, contagem de erros, mensagens de erro.
Utilitários de Nível Superior
POXTools
+ (nullable NSData*)merge:(NSArray<NSString*>*)paths error:(NSError**)error;
+ (nullable NSData*)addTimestamp:(NSData*)pdfData sigIndex:(int32_t)sigIndex tsaUrl:(NSString*)tsaUrl error:(NSError**)error;
Mescla os PDFs nos caminhos informados em um único PDF em memória; anexa um timestamp de documento RFC 3161 a uma assinatura.
POXCrypto
+ (nullable NSString*)activeProviderWithError:(NSError**)error;
+ (nullable NSString*)cbomWithError:(NSError**)error;
+ (nullable NSString*)inventoryWithError:(NSError**)error;
+ (nullable NSString*)policyWithError:(NSError**)error;
+ (int32_t)fipsAvailable;
+ (int32_t)useFips;
+ (int32_t)setPolicy:(NSString*)spec;
Introspecção do provedor de criptografia (provedor ativo, CBOM CycloneDX, inventário, política) e controles de política FIPS.
POXModels
+ (nullable NSString*)manifestWithError:(NSError**)error;
+ (int32_t)prefetchAvailable;
+ (nullable NSString*)prefetchModels:(NSString*)languagesCsv error:(NSError**)error;
Lê o manifesto de modelos empacotados, verifica a disponibilidade de pré-busca (prefetch), e pré-busca modelos de ML para os códigos de idioma informados.
POXConfig
+ (int64_t)setMaxOpsPerStream:(int64_t)limit;
+ (int32_t)setPreserveUnmappedGlyphs:(int32_t)preserve;
Controles globais do processo: limita o número de operadores decodificados por content stream, e alterna a preservação de glifos não mapeados no texto extraído. Cada um retorna o valor anterior.
Tipos de Valor
Estes tipos NSObject somente leitura são retornados pelos métodos de extração acima.
POXChar
| Property | Tipo | Descrição |
|---|---|---|
character |
uint32_t |
Codepoint Unicode |
bbox |
POXBbox |
Bounding box |
fontName |
NSString* |
Nome PostScript da fonte |
fontSize |
float |
Tamanho da fonte em pontos |
POXWord
| Property | Tipo | Descrição |
|---|---|---|
text |
NSString* |
Texto da palavra |
bbox |
POXBbox |
Bounding box |
fontName |
NSString* |
Nome PostScript da fonte |
fontSize |
float |
Tamanho da fonte em pontos |
bold |
BOOL |
Se a palavra está em negrito |
POXTextLine
| Property | Tipo | Descrição |
|---|---|---|
text |
NSString* |
Texto da linha |
bbox |
POXBbox |
Bounding box |
wordCount |
NSInteger |
Número de palavras na linha |
- (nullable NSString*)cellTextAtRow:(NSInteger)row col:(NSInteger)col; // POXTable
POXTable
| Property / Método | Tipo | Descrição |
|---|---|---|
rowCount |
NSInteger |
Número de linhas |
colCount |
NSInteger |
Número de colunas |
hasHeader |
BOOL |
Se a tabela tem uma linha de cabeçalho |
cellTextAtRow:col: |
NSString* |
Texto da célula em (row, col) (nil se fora do intervalo) |
POXFont
| Property | Tipo | Descrição |
|---|---|---|
name |
NSString* |
Nome da fonte |
type |
NSString* |
Tipo da fonte (ex.: TrueType, Type1) |
encoding |
NSString* |
Codificação da fonte |
embedded |
BOOL |
Se a fonte está incorporada |
subset |
BOOL |
Se a fonte é um subconjunto (subset) |
size |
float |
Tamanho nominal em pontos (0 se desconhecido) |
POXImage
| Property | Tipo | Descrição |
|---|---|---|
width / height |
NSInteger |
Dimensões em pixels |
bitsPerComponent |
NSInteger |
Bits por componente de cor |
format |
NSString* |
Formato da imagem |
colorspace |
NSString* |
Espaço de cor |
data |
NSData* |
Bytes codificados da imagem |
POXAnnotation
| Property | Tipo | Descrição |
|---|---|---|
type / subtype |
NSString* |
Tipo e subtipo da anotação |
content / author |
NSString* |
Conteúdo e autor |
rect |
POXBbox |
Retângulo da anotação |
borderWidth |
float |
Largura da borda |
color |
uint32_t |
Cor empacotada como 0xAARRGGBB (0 se ausente) |
creationDate / modificationDate |
int64_t |
Segundos desde o epoch Unix (0 se ausente) |
hidden / markedDeleted / printable / readOnly |
BOOL |
Flags |
linkUri |
NSString* |
URI de destino para anotações Link (anulável) |
iconName |
NSString* |
Nome do ícone para anotações Text/note (anulável) |
quadPoints |
NSArray<NSArray<NSNumber*>*>* |
Quad points para anotações Highlight |
POXFormField
| Property | Tipo | Descrição |
|---|---|---|
name |
NSString* |
Nome do campo |
value |
NSString* |
Valor atual |
type |
NSString* |
Tipo do campo |
readonly |
BOOL |
Se o campo é somente leitura |
required |
BOOL |
Se o campo é obrigatório |
POXPath
| Property | Tipo | Descrição |
|---|---|---|
bbox |
POXBbox |
Bounding box |
strokeWidth |
float |
Largura do traço |
hasStroke / hasFill |
BOOL |
Se o caminho tem traço / preenchimento |
operationCount |
NSInteger |
Número de operações do caminho |
POXSearchResult
| Property | Tipo | Descrição |
|---|---|---|
text |
NSString* |
Texto correspondente |
page |
NSInteger |
Índice de página baseado em zero |
bbox |
POXBbox |
Bounding box da correspondência |
POXRenderedImage
| Property / Método | Tipo | Descrição |
|---|---|---|
width / height |
NSInteger |
Dimensões em pixels |
data |
NSData* |
Bytes codificados da imagem (ex.: PNG) |
saveToPath:error: |
BOOL |
Grava a imagem renderizada em um arquivo |
close |
void |
Libera o handle nativo |
Tratamento de Erros
Operações com falha retornam nil / NO / um status negativo e preenchem o parâmetro de saída NSError** com um erro no POXErrorDomain:
NSError* error = nil;
POXDocument* doc = [POXDocument openPath:@"input.pdf" error:&error];
if (!doc) {
NSLog(@"Open failed: %@", error.localizedDescription);
return;
}
NSString* text = [doc extractText:0 error:&error];
if (!text) {
NSLog(@"Extraction failed: %@", error.localizedDescription);
}
[doc close];
Exemplo Completo
#import <PdfOxide/POXPdfOxide.h>
NSError* error = nil;
// --- Extraction ---
POXDocument* doc = [POXDocument openPath:@"input.pdf" error:&error];
NSInteger pages = [doc pageCountError:&error];
for (NSInteger i = 0; i < pages; i++) {
NSString* md = [doc toMarkdown:i error:&error];
NSLog(@"Page %ld: %lu chars", (long)i, (unsigned long)md.length);
}
// Render page 0 to PNG
POXRenderedImage* img = [doc renderPage:0 format:0 error:&error];
[img saveToPath:@"page0.png" error:&error];
[doc close];
// --- Creation ---
POXDocumentBuilder* builder = [POXDocumentBuilder createWithError:&error];
[builder setTitle:@"Report" error:&error];
POXPageBuilder* page = [builder letterPageWithError:&error];
[page heading:1 text:@"Report" error:&error];
[page paragraph:@"Generated by PDF Oxide." error:&error];
[page done:&error];
[builder saveToPath:@"report.pdf" error:&error];
// --- Editing ---
POXDocumentEditor* editor = [POXDocumentEditor openEditor:@"document.pdf" error:&error];
[editor rotateAllPages:90 error:&error];
[editor setFormField:@"name" value:@"John Doe" error:&error];
[editor saveToPath:@"output.pdf" error:&error];
[editor close];
Other Language Bindings
O PDF Oxide oferece bindings nativos para todos os principais ecossistemas: Rust, Python, Node.js, WASM, C#, Golang, Java, PHP, Ruby, C++, Swift, Kotlin, Dart, R, Julia, Zig, Scala, Clojure e Elixir.
Próximos Passos
- Tipos e Enums — todos os tipos e enums compartilhados
- Referência da API Page — iteração consistente por página entre os bindings
- Primeiros Passos com Objective-C — tutorial