PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting Stylesheet definition results in emtpy pdf document Re: Re: Stylesheet definition results in emtpy pdf document


Sorry for the delay with the reply.

@mil wrote:

we have a problem in conjunction with the definition of stylesheets. Currently we set the stylesheet file via call to PD4ML.addStyle(), e.g.
[language=java:2kj4szg5]pdfCreator.addStyle(someUrl, true);[/language:2kj4szg5]

We define the page header using the method PD4ML.setPageHeader(somePD4PageMark).

We use PD4PageMark.setHTMLTemplate(someHTML) to set the HTML content.

addStyle() method impacts only the main document and headers/footers defined inline (with tag, for example)

First of all: Does “someHTML” have to be valid HTML, that means does it have to contain tags like “” or ““?

Yes, if you need to specify a style to a header or footer defined API- way, “someHTML” should contain all the , , tags and a style section or a reference to an external stylesheet. Unfortunately it cannot inherit style of the main document.

After that, we render the page using the method PD4ML.render(someURL, someStream);

The problem concerning the stylesheet definition now is as follows:
The stylesheet file contains the following style definition:

body {
background-color: white;
font-family: Arial,Helvetica,Geneva,sans-serif;

The resulting pdf document only contains the header, but not the content retrieved by call to PD4ML.render(). (We found out that the content somehow gets painted over by the background-color.)
After removing “background-color: white” out of this style definition, everthing works fine. As our customers can define their own styles for their printings, we cannot assure that a customers won’t create a stylesheet we ran in problems with. Could you please instruct us how to prevent that issue?

It seems to be a bug in our code. In the most recent betas of v351 we addressed a similar issue. By the way, which PD4ML version do you use? You may check that if you open a generated PDF in Acroread and inspect File->Properties->Application