I want to print the current page number inside the defined textheight, textwidth frame on a Latex document, rather than at the page bottom.
How can I retrieve the current page number somehow for each page and then print it inside my text region? Can I call the page number up somehow on any given page? And insert it. Not as a \label or a \cite job ?
After long fumbling along trying to get that page number to show under \pagenumber or the like, I finally hit upon \thepage. If one is on p. 48, say, and wants to display that number anywhere in the text of p. 48, one simply types \thepage to have 48 appear where it is set in the text. So simple, but it stumped me.
Why did I want that? I made the page height and page width the exact dimensions of an 8.5 by 11 page. Then - unfortunately - page numbers are automatically set below the bottom edge of the printed window of every page. And become invisible!
Now I learnt how to print the current page number inside the visible page. Why did I use the full size of the paper? Because I was building a pdf file for a book and I wanted a seamless edges to edges picture on its front cover. Therefore the full size page width and page height ... Thanks!
\thepage, \thechapter etc was the answer. Sorry I asked.
Related
I got a number of dots of page control, obviously it's too long and beyond the screen width.
Set pagecontrol=[[UIPageControl alloc] initWithFrame:CGRectMake(108, 500, 100, 50)]; to contraint its width, but looks not work.
Is it possible to divid these dots into two lines or even more?
Taking a look at the Tasks UIPageControl offers, there's no easy way to implement multi-line page control. Also, the sizeForNumberOfPages: method, there's no break mode or anything to allow you to control the number of dots per line, it will most likely just return X * dotSize, where X is the number of pages.
Also, the note On iPhone and iPod touch, about 20 page control dots fit on the screen before they are clipped says that there's no built in method to create multi-line page control.
You can of course always create a custom class, but I REALLY wouldn't suggest doing that. The user won't expect (or like) a multi-line page control anyway.
You can use something like 10 of 50 like the iBooks app uses.
We are developing a BI Publisher invoice print report using RTF layout. This report prints the customer details at the top of the page, followed by the invoice lines' details, and a summary table (of amounts and taxes) at the bottom of the page. Brought-forward are carry-forward totals are displayed at the top and bottom of each page (in case of multi-page reports).It is important to maintain the consistency of the print format (so that the customer address is always at the top left corner of the page, summary table is always printed at the bottom etc). To print the summary at the bottom of the page for each invoice, we have used the tag with section break, as recommended in the user guide. This works fine in situations when the invoice has multiple lines spilling over to the second page.
However, we are facing an issue in a particular scenario : Invoice has few lines that fit in the first page itself, but there is no space left to print the summary table in the same page , so the summary table alone is printed in the second page at the bottom. In this case the carry-forward total in page 1 and the brought-forward total in page 2 are not being displayed. If you have observed a similar issue anytime please suggest how to fix this.
Consider separating your sections and not using Word's header and footer.
Place this code at the start of your document
<?initial-page-number:'1'?>
<?call-template:tHEADER_VERSO?>
<?start:body?>
<?call-template:tHEADER_RECTO?>
<?call-template:tCONTACT?>
<?for-each#section:On_Payment_Terms_S3?>
<?call-template:tDETAILS?>
<?end for-each?>
<?end body?>
<?call-template:FOOTER?>
Then to define a section
<?template:tFOOTER?>
insert content here
<?end template?>
That way the document will always preserve enough space to print your carry-forward totals. I experienced the same odds results when you put your carry-forward in the Word's footer.
I have a form which has a table which may contain 0 rows or several rows.
The problem is that if there are several rows I want close the table on the first page before the content spills over to the next page. Then create another table for the rest of the rows on the next page along with a nice header and table headings. The hard part is, because characters have different widths and I can't predict what the user will type, it's hard to calculate how many characters can fit on a row and how many rows can fit on a page. Also if the user types something in some of the row data, it wraps to a 2nd row.
The printout looks bad when the row has only a few rows because there is a lot of whitespace on the bottom so I was thinking of adding in blank rows to fill it up. But again, I won't exactly know how many rows I need to fill before it spills onto the next page.
Does anyone have a solution to this?
EDIT:
Sorry about that. To be more clear on what I'm doing, I created a form view using CF and HTML which mimics visually like a paper invoice. Invoice line items can be added in dynamically via AJAX. There's a bunch of info to be filled out on top (Company name, address, etc), then in the middle there's the invoice lines in a table with column headings, then under it there's more info to fill out including signature fields. This format cannot be changed as it is a requirement.
So the form layout is:
Top section (info including customer info and a bunch of other things)
Middle section (table of invoice line items)
Bottom section (a bunch of other info including signature fields)
Visually on the page the above format is maintained and if there's a lot of invoice line items added, the page just scrolls and the bottom section is still at the end.
An unlimited number of invoice lines can be added so if you simply just print the page, the invoice lines will overflow onto the next page and the "bottom info" including signatures will be on whatever page the last page may be, which is undesired.
I need it so that whatever number of lines that can fit on the first page without having the form overflow be displayed on the first page along with the "bottom info" including signature. The extra lines are displayed on the next pages with headings "Continuation Page" along with the table column headings of the invoice lines.
My solution is to create a "print view" which creates the form with entered info and cfloops the invoice lines query but only loop just enough to fill the first page. If the addition of another row makes the form overflow then I would stop the loop, display the rest of the form with the "bottom info" and signatures so it all fits on the first page nicely, then do a page break with the header "Coninuation Page" and display the invoice line table with column headers and the rest of the invoice line items. Of course if the continuation page is going to overflow then I would need to do a page break and repeat the "Continuation Page" process. The tricky part is how to determine how many lines can actually fit on the page because the length of data in each row varies depending on user input. Maybe only one invoice line row filled with tons of data is all that can fit on the first page without having the form overflow. Maybe it's 10 invoice line rows when little data is entered.
My main purpose is to keep the entire form on the first page. If several invoice line items are added which pushes the bottom of the form onto the next page then I want to display only enough invoice line rows to keep the form on the first page and have a Continuation Page for the rest of the invoice lines that didn't fit on subsequent pages.
Note: The print is done via a print link on the form page which pops up the print view page (without site heading, etc.) in another window. From there they can either print from the browser or click on a print link that does a javascript print. the same "print view" I created to print the invoice nicely is also used for a PDF view created using CFDocument. The number of characters per line is not the same in the generated PDF as the HTML print view so it's even harder to determine how many rows can fit.
If I understand your question correctly, then a PDF generated with CFDocument would seem to be the optimal solution. Using the cfdocumentitem tag you can specify headers and footers, which insure that the content you want appears on the first page. The cfdocument.currentpagenumber variable can be used to insure that it only appears on page one, and that the header on pages 2+ display the "Continuation Page" text that you desire. There is also a way to get the PDF to auto-print using a DDX file, though that is subject to security limitations.
You mention using CFDocument to create a separate print view, but I didn't see an explanation as to why an HTML version was required as well. I apologize if I missed it.
From personal experience with a similar project last year I would tend to recommend against using CSS for this and instead just require a PDF reader. It's possible that someone with more skill than I could make it work easily, but it was nothing but a headache for us and we could never get it to work quite right.
This app involves converting a book into an app. It has rich text (headings, bold, bullets, etc.) and instead of a page flip UI, it would be built in a split view controller. The master (left sidebar) would list chapters and bookmarks. The detail (right side) would have the chapter's contents and it would scroll down until the end of the chapter. Similar to Apple's Mail app on the iPad.
From my research, I can achieve the rich text by using HTML inside a UIWebView. What I'm not sure about is how to get bookmarks to work properly. Because there are no pages, the bookmark would need to be a vertical point in the chapter's content. For example, lets say the user reads half of Chapter 2, i.e. they have scrolled 50% of the way down. They could create a bookmark here.
My initial thoughts are to break the book's content up into "blocks", possibly paragraphs. For each chapter, in the detail view, use a UITableView. In each UITableViewCell, have a UIWebView with the HTML for each block. This way when the user creates a bookmark, we can store the cell's index path.
What would be the correct approach to this app?
I have created the same kind of e-book once, called Afili Lugat.
My approach was using javascript method:
element.scrollTop
to get the scrollbar position and keep that position under a SQLite database with a name for the bookmark. For this e-book I struggled with font size because it was changeable. When a user changes the font size the scroll position was not correct anymore as the page length increases/decreases. So I was keeping the font size in the SQLite database. So I was loading the page, changing the font size and scroll the page to offset value that I was getting from element.ScrollTop using window.scrollBy(0,<offsetvalue>);
Hope this helps.
Uygar
I want to build an app for iPad like a book, with two pages, with one column each.
After read some text from a database, I want to fulfill the two pages (with the right quantity of text), and save whats left to the next page. I will display some images between the text, and I need to make the text and image to fit in each page.
I'm thinking in use a UIWebView to hold the text.
My problem it's calculate the amount of text needed for each page and the text that left.
Can you help me doing that?
I will display some images between the text, and I need to make the text and image to fit in each page.
UIWebView is the wrong UI element to use if you just want to display text. You should know that loading a UIWebView takes long and eats up a lot of memory. This is a job for UITextView.
To calculate the text that will fit on a page, you will have to use the methods that UIKit adds to NSString. Here is the documentation. These help you to calculate the size a string will be when rendered with a certain font and certain line break mode.
CGSize renderedTextSize = [myString sizeWithFont:myFont forWidth:myTextView.frame.size.width lineBreakMode:UILineBreakModeWordWrap];
You could write a method that would use these methods calculate a substring of the text that will fit on your current "page" (UITextView). Then, for the next "page", start from where you left off on the last page and add text to that string until it fits perfectly in your text view (maybe you add words until it gets too big to fit, then take out the last word and return that substring).
Something like that should work.