Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

272
Views
Obtenga el recuento total de páginas y la vista rápida de la página actual

Estoy usando 'QLPreviewController' para mostrar el archivo del documento (pdf/doc). ¿Hay alguna forma de obtener el número total de páginas y también el número de página actual?

O cualquier otra forma de ver pdf/doc y también obtener recuentos de páginas. ingrese la descripción de la imagen aquí

Como "9 de 9" - Cómo conseguir eso

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

QuickLook solo para look mate. Puede obtener metadatos de CGPDFDocument

 if let url = Bundle.main.url(forResource: "yourFileNameHere", withExtension: "pdf"), let pdf = CGPDFDocument(url as CFURL) { let count = pdf.numberOfPages print(count) }

Para docx, intente instalar ZipZap con cartago: github "pixelglow/ZipZap" "8.1"

 NSURL *url = [[NSBundle mainBundle] URLForResource:@"demo" withExtension:@"docx"]; ZZArchive* archive = [ZZArchive archiveWithURL:url error:nil]; NSString *pageCount; for (ZZArchiveEntry* entry in archive.entries) { if([entry.fileName isEqualToString:@"docProps/app.xml"]) { NSString *responseString = [[NSString alloc] initWithData: [entry newDataWithError:nil] encoding:NSUTF8StringEncoding]; //Get the value between tag <Pages> and </Pages> NSRange tag1 = [responseString rangeOfString:@"<Pages>"]; NSRange tag2 = [responseString rangeOfString:@"</Pages>"]; pageCount = [responseString substringWithRange: NSMakeRange((tag1.location + tag1.length), (tag2.location - tag1.length - tag1.location))]; } }

Aquí la fuente de metadatos de docx: https://www.forensicswiki.org/wiki/Word_Document_(DOCX)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!