CSS3 paged media mode: Any way to prevent @top_right pdfreactor logo being inserted?

1.1k Views Asked by At

With any attempt to use paged media mode, with for example a style sheet containing :

 <html><header>...<style type="text/css"> ...
 body { counter-reset: chapter 1;
   counter-reset: section 1;
   counter-reset: page 1;
   margin-left:  +2%;
   margin-right: -2%;
   font-size: 10pt;
 }
 @page { size : a4 ; 
         margin: 8%;
    @top-left   { content: "abbrv"; ; font-size: 8pt;}
    @top-center { content: "Chapter " counter(chapter) " : " counter(section); font-size: 8pt;}
    @top-right  { content: "$date : $initials"; ; font-size: 8pt; }
    @bottom-center { content: "Page " counter(page) " / " counter(pages); font-size: 8pt; }    
  }
  div.chapter {
     break-before : always;
     counter-increment: chapter;
     counter-reset:     section;
  }
  section.section {
     counter-increment: section;
  }
  </style></header><body>
  <div id="chap1" class="chapter"><h1>Chapter 1</h1></div>
  ...</body></html>

Note the above does not contain ANY reference to embedded images, but when run through PDFreactor the resulting PDF contains a small round radio-active graphic with the word "PDF" overlaid on top , in the @top-right content, after my "$date : $initials" content.
I think this is "pdfreactor.svg" ?

So is it not possible to remove the logo ?

Moving all files named pdfreactor.svg under the PDFreactor/ installation directory to other locations did not help.

I am using the free-for-personal-non-commercial license which I obtained by email from Real Objects ,NOT the evaluation license .

Are personal non-commercial users not allowed to disable the inclusion of this logo in the page header block ?

Has anyone succeeded in disabling the inclusion of the logo image - if so, how ?

Also, does anyone know why the chapter & section counters are always displayed as 0 in the page header of the above document?

The Java I am using is:

import java.io.File;
import java.io.FileOutputStream;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.realobjects.pdfreactor.Configuration;
import com.realobjects.pdfreactor.PDFreactor;
import com.realobjects.pdfreactor.Result;
import com.realobjects.pdfreactor.Log;
import com.realobjects.pdfreactor.Record;
import com.realobjects.pdfreactor.events.DefaultHandler;

class PDFReactor
{
  public static void main( String args[] )
  { File html_in = null , pdf_outf=null;
    String html_in_url = null;
    FileOutputStream pdf_out=null;
    boolean expect_in=false , expect_out=false;
    Logger logger = null;
    try {
      logger = Logger.getAnonymousLogger();
      logger.setUseParentHandlers(false);
      logger.setLevel(Level.INFO);
      logger.addHandler(new DefaultHandler());
    }catch(Exception e)
    { System.err.println("Failed to get logger: " + e.toString());
    }
    for ( String arg : args )
    { switch(arg)
      { case "-f" :
          expect_in=true;
          break;
        case "-o" :
          expect_out=true;
          break;
      default:
        if(expect_in)
        { expect_in = false;
          try {
              html_in = new File( arg );
              html_in_url = html_in.toURI().toURL().toString();
            } catch (Exception e)
          { System.err.println("new File ( " + html_in + ") failed : "+e.toString());
          }            
        }else
        if(expect_out)
        { expect_out = false;
          try {
              pdf_outf = new File( arg );
              pdf_out = new FileOutputStream( pdf_outf );
            } catch (Exception e)
          { System.err.println("new File ( " + pdf_out + ") failed : "+e.toString());
          }            
        }
      }      
    }
    if( (html_in != null) && (pdf_out != null) && (logger != null))
    {
      try
      { PDFreactor r = new PDFreactor();
        if( r != null )
        { Configuration configuration = new Configuration();
          configuration.setLicenseKey(
            my_license_key_xml
          );
          configuration.setDocument(html_in_url);
          configuration.setLogger(logger);
          List<Configuration.ViewerPreferences> prefls = configuration.getViewerPreferences();
          int n=prefls.size() + 1, i=0;
          Configuration.ViewerPreferences[] prefs = new Configuration.ViewerPreferences[ n ];
          for( Configuration.ViewerPreferences p : prefls )
          { prefs[i] = p;
            i+=1;
          }
          prefs[i]= Configuration.ViewerPreferences.PAGE_MODE_USE_OUTLINES;
          configuration.setViewerPreferences( prefs );
          configuration.setAddLinks(true);
          configuration.setAddBookmarks(true);
          Result result = r.convert(configuration, pdf_out);        
          pdf_out.close();
          if( result != null )
          { Log l = result.getLog();
            if( l != null)
            { for( Record rec : l.getRecords() )
                System.err.println(rec.getMessage());
            }else
            {  System.out.println("No log records produced.");
            }
          }
        }else
        { System.err.println("new PDFreactor failed.");
        }
      }catch( Exception e)
      { System.err.println("PDFreactor conversion failed: "+e.toString());
      }
    }else
    { System.err.println("Expected -f <html input file name> -o <pdf output file name> arguments.");
    }
  }
}
1

There are 1 best solutions below

2
On

All PDFs created with PDFreactor using a "Free Personal License" contain this PDFreactor logo. This is intended and referred to as "notices that identify PDFreactor" in the PDFreactor software license agreement which you accepted when requesting a "Free Personal License" key and by using the software. According to the agreement these notices (such as the logo) must not be removed or tampered with in any way. Should you require PDFs without any notices you have to buy and use a commercial license of PDFreactor.

Regarding the counter issues: You are defining the counters in the wrong scope. To use them in page margin boxes, you have to initialize the counters in the "@page" rule and not in the "body" element like this:

@page:first {
    counter-reset: chapter 0 section 0;
}

Also, multiple "counter-reset" properties override previous ones, so only use one "counter-reset" property for multiple counters as shown above.