Sunting PDF ing Swift SDK

Gunakake REST API kanggo nyunting PDF ing Swift kanthi terprogram

Nalika pangembang ngowahi PDF dokumen nganggo perpustakaan Swift iki, sing lagi diowahi yaiku Model Obyek Dokumen (DOM). Dadi, meh kabeh owah-owahan bisa ditindakake kanggo PDF dokumen sing diwakili minangka DOM. Kanthi Swift SDK sing disedhiyakake, pangembang bisa kanthi gampang nyunting dokumen: ngowahi teks, nganyari tabel, nambah gambar lan liya-liyane. Cukup mbukak PDF, gawe owah-owahan sing dibutuhake kanthi program lan ekspor asil menyang format nyimpen sing padha utawa sing didhukung.

Ndeleng potongan kode

Sunting PDF ing Swift nggunakake REST API

Pustaka Swift kita menehi pangembang kemampuan kanggo ngowahi PDF dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.

Sunting teks ing PDF file nggunakake Swift

Kasus sing paling populer kanggo nyunting PDF file yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake Swift ing dokumen kasebut.

Sunting tabel ing PDF file nggunakake Swift

Pilihan editing PDF liyane sing populer yaiku nyunting tabel. Swift SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.

Pangembang Swift bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.

Tambah gambar menyang PDF file nggunakake Swift

Saliyane nyunting teks lan tabel ing PDF, ana pilihan umum liyane: nambahake gambar menyang dokumen ing Swift. Pangembang Swift uga bisa nambah gambar menyang PDF file nggunakake DOM.

Sunting PDF kanthi terprogram

Coba Swift SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan PDF dokumen. Nggunakake conto ing ngisor iki, muat PDF dokumen lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang PDF dokumen:

Unggah dokumen sing pengin diowahi
Kode roto
Unggah gambar sing pengin dilebokake
Pilih format target saka dhaptar
import AsposeWordsCloud

let config = Configuration(clientId: "####-####-####-####-####", 
   clientSecret: "##################");
let api = try WordsAPI(configuration: config);

let requestDocument = InputStream(url: URL(string: "Input.pdf"))!;
let requestParagraph = ParagraphInsert()
  .setText(text: "Morbi enim nunc faucibus a.");
let insertParagraphRequest = InsertParagraphOnlineRequest(document: requestDocument, 
   paragraph: requestParagraph);
let insertParagraph = try api.insertParagraphOnline(request: insertParagraphRequest);

let convertRequest = ConvertDocumentRequest(document: insertParagraph.document.values.first,
  format: "pdf");
let convert = try api.convertDocument(request: convertRequest);
import AsposeWordsCloud

let config = Configuration(clientId: "####-####-####-####-####", 
   clientSecret: "##################");
let api = try WordsAPI(configuration: config);

let requestDocument = InputStream(url: URL(string: "Input.pdf"))!;
let requestTable = TableInsert()
  .setColumnsCount(columnsCount: 1)
  .setRowsCount(rowsCount: 2);
let insertTableRequest = InsertTableOnlineRequest(document: requestDocument, 
   table: requestTable, nodePath: "");
let insertTable = try api.insertTableOnline(request: insertTableRequest);

let convertRequest = ConvertDocumentRequest(document: insertTable.document.values.first,
  format: "pdf");
let convert = try api.convertDocument(request: convertRequest);
import AsposeWordsCloud

let config = Configuration(clientId: "####-####-####-####-####", 
   clientSecret: "##################");
let api = try WordsAPI(configuration: config);

let requestDocument = InputStream(url: URL(string: "Input1.pdf"))!;
let requestDrawingObject = DrawingObjectInsert()
  .setHeight(height: 0)
  .setLeft(_left: 0)
  .setRelativeHorizontalPosition(
     relativeHorizontalPosition: DrawingObjectInsert.RelativeHorizontalPosition.margin)
  .setRelativeVerticalPosition(
     relativeVerticalPosition: DrawingObjectInsert.RelativeVerticalPosition.margin)
  .setTop(top: 0)
  .setWidth(width: 0)
  .setWrapType(wrapType: DrawingObjectInsert.WrapType.inline);

let requestImageFile = InputStream(url: URL(string: "Input2.pdf"))!;
let insertDrawingObjectRequest = InsertDrawingObjectOnlineRequest(document: requestDocument, 
   drawingObject: requestDrawingObject, imageFile: requestImageFile, nodePath: "sections/0");
let insertDrawingObject = 
   try api.insertDrawingObjectOnline(request: insertDrawingObjectRequest);

let convertRequest = ConvertDocumentRequest(
   document: insertDrawingObject.document.values.first, format: "pdf");
let convert = try api.convertDocument(request: convertRequest);
Kode roto
  
Nyalin kode Swift menyang clipboard

Cara Ngowahi PDF ing Swift

  1. Pasang 'Aspose.Words Cloud kanggo Swift'
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek Swift sampeyan
  3. Muat PDF kanggo nyunting ing Swift
  4. Lebokake isi ing wiwitan PDF
  5. Download dokumen asil saka panyimpenan maya

Pustaka Swift kanggo nggunakake panyuntingan PDF.

Sampeyan bisa nggunakake manajer paket Swift lan manajer dependensi Cocoapods kanggo nginstal Aspose.Words Cloud SDK for Swift. Informasi rinci babagan nginstal paket diwenehi ing bagean "Installation and Usage".

Minangka alternatif, sampeyan bisa clone Aspose.Words Cloud SDK for Swift saka GitHub lan nggunakake ing project.

Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.

Requirements Sistem

Swift 4.2 utawa luwih anyar

Deleng Repository Documentation kanggo ndeleng rincian liyane.

Format file liyane sing didhukung

Sampeyan bisa nindakake operasi suntingan kanggo format file liyane:

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.