How can I draw a line over all pages in fpdf - line

Just as I ask in the title, how can I draw a line over all pages using fpdf?
I tried giving the line a height of 9000, but this only gave a line to the full first page, but not on any other pages.
Anyone knows how I can solve this? Thanks!

In FPDF, the header method is called automatically when a new page is created. From the API:
This method is used to render the page header. It is automatically called by AddPage() and should not be called directly by the application. The implementation in FPDF is empty, so you have to subclass it and override the method if you want a specific processing.
Here's the steps you take:
Ensure that your PDF class extends FPDF's
Override the header method in your extension
Add your line-drawing code to the header method.
This is the simplest solution. No keeping track of whenever a new page is added. FPDF does it automatically, so build off of their API to achieve your goal.

Related

iTextSharp - Header and Footer for all pages

I'm generating PDF by adding single PdfPTable which accommodates multiple pages.
Now I want to add header and footer to all these pages but it is only displaying on first page. Also margins are not working correctly.
I am overriding OnStartPage/OnEndPage events of class PdfPageEventHelper.
Kindly suggest best way to incorporate header and footers.
Thanks
Rule #1: don't use OnStartPage() to add a header or a footer. Use the OnEndPage() method only to add both the header and the footer.
Rule #2: don't add content to the Document object passed as a parameter to the event method. Use the DirectContent of the PdfWriter instead.
Rule #3: read the documentation and look at the examples and Q&As marked header and footer
You'll notice that your question is a duplicate of:
How to add HTML headers and footers to a page? (Java example)
How to generate a report with dynamic header in PDF using itextsharp? (C# example)
How to add text as a header or footer?
...
This answers your question: Kindly suggest best way to incorporate header and footers.
Your question about "margins not working correctly" is probably answered here: Why is my content overlapping with my footer? However, saying "margins are not working correctly" isn't an actual question. If I tell my doctor: "I don't feel well, please help me!" I can't expect him to help me if I don't give him more info. When I add headers and footers, the margins work correctly. If it doesn't work for you, you are doing it wrong...
The same is true for your allegation that the header and footer "is only displaying on first page." That's simply not true from our point of view. If you add the event to a PdfWriter like this:
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
Header event = new Header();
writer.setPageEvent(event);
Then the OnEndPage() method is invoked every time a page is finalized.

slideshow inside header.tpl

I am using Opencart 1.5.3.1 with custom theme.
Having problem with positioning the slideshow inside the header itself (i.e. in header.tpl).
I have learned the way to make new position for slideshow module, but it is only showing it up before or after the header - and I need it to be inside of it.
Once I made to be before or after the header, I tried to echo it inside the header.tpl file but it gives me the message:
Warning: Undefined variable...
Anybody can help with this?
Modules cannot be placed inside the header, it is purposely built this way. Each section of the page has its own controller and usually a model. The reason you are getting a variable error is the sideshow controller is not loaded, only the header controller and model is.
Without changing the core of the module integration you would be better trying to implement the slide show controller in the header controller.

Adding Multiple web pages to UIWebview in a Page-Based app

I am working on making a paged app that will load a separate HTML page on each page. I am using the already given example that Apple has provided and rigged it to make the label dissapear and a few other things. Most tutorials I have seen do not cover this idea at all.
I need to be able to make an array of webpages and using one UIWebview display those pages, obviously one HTML file per page. What will be the most efficient way to do this that is up to date with iOS5 or is there a recent tutorial I can follow? Thanks.
Depending on how much data you have you could serialize the HTML data in a single file (such as a plist) or have them as separate files in a directory.
Based on the template you are using, you would
change the view in DataViewController to a UIWebView;
then override the viewControllerAtIndex method in your ModelController and pass the path to your HTML page as the data object;
and finally load the HTML in the viewWillAppear method of your DataViewController.
VoilĂ , here is your tutorial!

How to pass a value between Silverlight pages for WP7?

I've got a MainPage.xaml page a Detail.xaml page.
I've passed variables to the Detail.xaml from MainPage.xaml by using a static variable and referencing it in Detail.xaml (the detail page is acting like a dialog). However once I've updated the content of another object, I want to call a method in MainPage.xaml to refresh the content of that page using the updated object from the Detail.xaml page.
I assume I am not using the correct paradigm for this and should probably be using MVVM or something but I'm not familiar with the implementation and was hoping there was a simple way to do this?
Can you load the content from the static into your control in the OnNavigatedTo?
You can make a method in your main page to do that job and call that.

Need to access the Page object in Global.asax in the PreRequestHandlerExecute

I have a huge website (containing around 5000+) pages. There is a theme functionality in the website where user can choose different colors for their profile. Now i want to use the ASP.net theme feature and put different CSS (for different colors) in the theme folder and in Global.asax i want check the user theme and render appropriate link element with the css. But my problem is, i am not able to access the Page element for adding the link in the page.
Here is my code
Dim page As System.Web.UI.Page = TryCast(System.Web.HttpContext.Current.Handler,System.Web.UI.Page)
page.StyleSheetTheme = "Black"
But when i run this code I get a Null reference error.
P.s : My application is very huge so its not possible to have a master page or a base class and inherit it in every page.
Please suggest.
The page is not available in PreRequestExecute. This function is called before asp.net steps in to handle things, and asp.net is responsible for the page. Think of PreRequestExecute as being earlier in the scheme of things, like when IIS is first trying to figure out what to do with this thing it has, the thing is not even a page yet.
You might want to look into some of the other events that you can hook, there are events that would take place after the page has loaded that may allow you to do what you are suggesting.
Rather than going into global.asax for this, consider using master pages. One possibility is to have nested master pages, where the first master page sets up overall layout, and the nested master handles the theme. (Or one of several nested master pages, all referencing the same top-level master page). If necessary, you can use the PreInit event in the page to change master pages, and select the master that matches your theme selection.
You can centralize this function by having your own class that inherits System.Web.UI.Page, and have all your own pages inherit this new class. Handle the PreInit event there. (As well as other useful functions, like page-level handling of unhandled exceptions, general security issues, etc.
EDITED TO ADD: As #aepheus correctly notes, the page hasn't been instantiated at the PreRequestHandlerExecute event. So there's no page class you can access.