PDFView display page number the way WKWebView shows for pdf - ios

I am trying to use PDFKit for rendering pdf. But I could not find any way to highlight page number while scrolling, the way it is shown in WKWebView.
Do I need to make a custom logic for it?

Related

Auto page break while creating PDF in iOS (Swift)

I have to create a PDF which contains data like a quotation document (text, tables, images, etc.). The data varies from 1 page to 3-4 pages. A table cell may have combination of text and images. Also, I have custom graphics to be rendered in PDF to show different shapes.
Example format:
I have tried PDFKit provided by Apple. I was able to draw individual parts. But I don't know how can I achieve auto page break mode (which shifts data to new page when there is no more space available in a page). One way to achieve this is that I have to calculate individual heights and divide data into pages as per available page size.
Is there any better way to do it using PDFKit?
I am also aware about creating PDF using UIGraphicsBeginPDFContextToData(). It also doesn't support auto page break. We have to call UIGraphicsBeginPDFPageWithInfo() for each new page.
I have also tried TPPDF and SimplePDF. Both don't support either page break on table or custom views.
I also can't go for HTML to PDF solution as I have custom views to be drawn in PDF.
Which is the best way in iOS to create PDF with above mentioned requirements?
"One way to achieve this is that I have to calculate individual heights and divide data into pages as per available page size." - this is the only way as PDFKit does not include automatic data layout and auto page breaks.

Adding Button/Label on Pdf Page using PDFKIT

I am trying to add some interactive buttons on pdf pages. I am showing Pdf file using Apple PDFKit and I have implemented UITapGesture, so when user tap on screen I show a annotation on it, issue is I want to mark this annotation as number like 1,2,3 etc. and whenever user click on this annotation user should be prompt a message that do you want to delete it? and then remove it.
Now,
How can I give annotation as numbers 1,2,3 etc.?
How can I add action on this same annotations? so that user can delete it on action?
Note: If you are unable to understand use case, then just take an example of placing balls of snooker game on different places.

Print a WebView content on duplex (front and back) printer with different margins for front and back

I have a WebView, and want to print it's HTML content via AirPrint. I want to add custom page margins to this content. I was able to achieve it using my own subclass of UIPrintPageRenderer
Now, whenever my app user is using duplex printer (printing front and back of the page), I want to set different page margins for front page and back page.
UIPrintPageRenderer was not able to achieve this task, since it asks for headerHeight, footerHeight as a single property and it does not have something like headerHeight(forPage:)
I also explored option of creating PDF file, but apparently PDF files are generated using UIPrintPageRenderer only.
Also, I don't know how to override or get custom UIViewPrintFormatter from WKWebView, since this object is returned by WebView's function func viewPrintFormatter() -> UIViewPrintFormatter

How to extract the currently visible text only from a UIWebView

I am loading a XHTML file in a uiwebview and paginating its content by dividing its content in columns by using "-webkit-column" property.
I need to find out the currently visible text on a uiwebview not the entire one( the entire text can be easily found by using "document.body.innerText" property)
I tried using "elementFromPoint" to find the currently visible text but its not working.
Can anybody help in finding out this.

Adding multipage printing to Windows 8 ListView App

I have an app with a ListView showing a list of summary items.
I've added print support, but I'm stuck on splitting my content into different pages.
I can add multiple pages, but I don't know how to split my content into pages based on page size.
Currently I have a xaml user control for my print content with a bound ItemsControl in it. I'd either like to bind to a list of just the items that will fit on the page, or move the top visible item position up based on the page number.
I'm not sure which is the best approach and I'm not sure how to do either.
The only paging example I could find in the docs was for a rich text block, which relies on the RichTextBlockOverflow control. I don't think that will help me.

Resources