Welcome Guest Search | Active Topics | Sign In | Register

How to start a <div> on a new even or odd page? Options
Fabien Bourdon
Posted: Tuesday, July 3, 2012 12:05:56 PM
Rank: Newbie
Groups: Member

Joined: 7/3/2012
Posts: 2
Hello,

I would like to know if it is possible to start some <div> (via a class for example) on a new odd or even page?

Thank you.
eo_support
Posted: Tuesday, July 3, 2012 8:35:42 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Please provide detailed information such as what product you are using, what exactly you mean by start some <div> and why you want to do that. The more information you give us the better chance you have to get a good answer. A one setence question usually won't get you anything as we have no idea what you are trying to do.

Thanks!
Fabien Bourdon
Posted: Wednesday, July 4, 2012 9:10:33 AM
Rank: Newbie
Groups: Member

Joined: 7/3/2012
Posts: 2
Sorry for having given so few information!

I am using EO.PDF on a ASP.NET Web Application (with a Developer License).
In this app, we can create a PDF of a "document" (document created dynamically on the app). It uses the "Generate As PDF" method on a web page (HTML to PDF).
I developed a page that create a PDF with several documents (one after the other). But I would like that on this PDF, each "document" start on a odd page (for printing convenience), by putting a blank page between them if needed. I can't know how many pages a "document" will take on the final PDF.
I'm looking for a marker to put on the HTML element of each "document" for example.

Thanks!
eo_support
Posted: Wednesday, July 4, 2012 10:26:46 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Thanks for the information. The only way you can do that is to convert your document into a PdfDocument first, then do a "post process" to insert blank pages between each page. It will be something like this:

1. If you use ASPXToPDF, you would need to pass false to RenderAsPDF so that it does not send the result directly to the client (because you need to add blank pages). You would then handle ASPXToPDF's AfterRender event to get the result PdfDocument object. If you do not use ASPXToPDF, then you should already have the PdfDocument object;

2. Once you have the PdfDocument object, you would call PdfDocument.Split to split it into an array of PdfDocument object, each of these PdfDocument object contains a single page of your original content. So if you have N pages, then you would have N PdfDocument objects here;

3. Create an array of (N - 1) new PdfDocument object, calling PdfDocument.Pages.Add to add a blank page to each of these PdfDocument objects. So now you have (N - 1) blank pages;

4. Call PdfDocument.Merge to merge all PdfDocument objects (2N - 1 in total) into a single PdfDocument object;

Hope this helps. Let us know if you still have any questions.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.