The Answer Archive
Providing students and professionals with answers to their toughest software, technology, math, and science problems. Browse the Archive!
Search Questions and Answers:

Show only unanswered questions

Avoid Page Break (html2ps/pdf from tufat.com)

Posted by tufat on 26 Sep 2008 at 11:54 AM
$4.00

Programming Languages / PHP

Hi.

I tried some things with the PHP html2ps version, but I'm still not getting the hang out on how to avoid page breaking.

According to the html2ps documentation, there should be an option page-break-inside: avoid, which I guess avoids breaking the page inside the HTML element specified. Whatever, it doesn't work for me and I'd really need this feature.

In general, all I have is a DIV container or TABLE element, while I have very large content inside the DIV or TD element. So how can I avoid page breaking of this content and instead, scale the content to a size that fits into one single PDF page?

My CSS looks like this:

@html2ps {
break-table: 0; // which should be set by default anyways
}

div, table, tr, td {
page-break-inside: avoid;
}

I also tried specifing style="page-break-inside: avoid" directly in the HTML elements and many other suspicious ways, without any luck.

All I want html2ps to do is to always print a certain table on one single page. This table contains many cells with graphics and text and in the end, it displays a special structure. If the table size is bigger than the page, scale it.

Are there any other special configurations needed? Do I use it wrong? Please help me, thanks in advance.

also posted here:
http://forum.tufat.com/showthread.php?t=52045

Your Answer or Comment:


Proposed Answers and Comments (oldest first)

In the event of multiple correct answers, you should accept the answer of the first user who provided a complete and valid answer to your question.

Proposed answer by sohel.rentacoder on 01 Oct 2008 at 03:28 AM

Page-break-inside only supports the opera web browser, that’s why you are facing the problem.
Please try Page-break-before, Page-break-before for the values of: auto | always | avoid | left | right.
Property CSS IE 6.0 IE 7.0 Firefox 2.0 Opera 9.0 S 2.0
Page-break-before 2.1 P P P Y P

Page-break-after 2.1 P P P Y P

Page-break-inside 2.1 N N N Y N


Where
Y = Yes, the feature is implemented completely per the W3C specification of what that feature is.
N= No, the feature is not implemented.
P = partial. the feature is partially implemented.
(plz adjust the table shifting right.)

Proposed answer by admin on 25 Sep 2008 at 10:21 PM

You can use the Nz function to return zero, a zero-length string (" "), or another specified value when a Variant is Null. Variant.

expression.Nz(Value, ValueIfNull)

expression Required. An expression that returns one of the objects in the Applies To list.

Value Required Variant. A variable of data type Variant.

ValueIfNull Optional Variant. Optional (unless used in a query). A Variant that supplies a value to be returned if the variant argument is Null. This argument enables you to return a value other than zero or a zero-length string. Note If you use the Nz function in an expression in a query without using the valueifnull argument, the results will be a zero-length string in the fields that contain null values.

Remarks
For example, you can use this function to convert a Null value to another value and prevent it from propagating through an expression.

If the value of the variant argument is Null, the Nz function returns the number zero or a zero-length string (always returns a zero-length string when used in a query expression), depending on whether the context indicates the value should be a number or a string. If the optional valueifnull argument is included, then the Nz function will return the value specified by that argument if the variant argument is Null. When used in a query expression, the NZ function should always include the valueifnull argument,

If the value of variant isn't Null, then the Nz function returns the value of variant.

The Nz function is useful for expressions that may include Null values. To force an expression to evaluate to a non-Null value even when it contains a Null value, use the Nz function to return a zero, a zero-length string, or a custom return value.

For example, the expression 2 + varX will always return a Null value when the Variant varX is Null. However, 2 + Nz(varX) returns 2.

You can often use the Nz function as an alternative to the IIf function. For example, in the following code, two expressions including the IIf function are necessary to return the desired result. The first expression including the IIf function is used to check the value of a variable and convert it to zero if it is Null.

varTemp = IIf(IsNull(varFreight), 0, varFreight)
varResult = IIf(varTemp > 50, "High", "Low")
In the next example, the Nz function provides the same functionality as the first expression, and the desired result is achieved in one step rather than two.

varResult = IIf(Nz(varFreight) > 50, "High", "Low")
If you supply a value for the optional argument valueifnull, that value will be returned when variant is Null. By including this optional argument, you may be able to avoid the use of an expression containing the IIf function. For example, the following expression uses the IIf function to return a string if the value of varFreight is Null.

varResult = IIf(IsNull(varFreight), _
"No Freight Charge", varFreight)
In the next example, the optional argument supplied to the Nz function provides the string to be returned if varFreight is Null.

varResult = Nz(varFreight, "No Freight Charge")

Ask a Question
Most Recent Questions
Most Recent Answers
Home Page

Login
Register

Information Technology
Software, Hardware, Design

Programming Languages
- ASP and ASP.NET
- Assembly and Machine Lang
- C and C++
- C#
- Carbon (Macintosh)
- Cold Fusion
- Delphi
- Flash
- FoxPro
- HTML and XHTML
- Java
- Javascript and JScript
- JSP
- Perl
- PHP
- Python
- Ruby on Rails
- VB, VBA, and VB.NET
- VBScript
- XML and XSL
Database
Graphic Design
Operating Platforms
Hardware and Networking

Math and Science
Homework Help

Biology and Geology
Math and Statistics
Chemistry
Physics
Engineering

Are you an information
technology or
math/science expert?

You can earn money by
providing answers to questions
at AnswerArchive.com.
Learn How

Browse Archive | Ask a Question | Most Recent Questions | Most Recent Answers | Home Page | Contact Us | Help
(c) 2008 The Answer Archive