-1

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.");
    }
  }
}
4

1 回答 1

1

使用“免费个人许可证”使用 PDFreactor 创建的所有 PDF 都包含此 PDFreactor 徽标。这是您在请求“免费个人许可证”密钥和使用软件时接受的 PDFreactor 软件许可协议中的“识别 PDFreactor 的通知”。根据协议,这些通知(例如徽标)不得以任何方式删除或篡改。如果您在没有任何通知的情况下需要 PDF,您必须购买和使用 PDFreactor 的商业许可证。

关于计数器问题:您在错误的范围内定义了计数器。要在页边距框中使用它们,您必须在“@page”规则中初始化计数器,而不是在“body”元素中,如下所示:

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

此外,多个“counter-reset”属性会覆盖之前的属性,因此如上所示,对于多个计数器仅使用一个“counter-reset”属性。

于 2017-01-16T15:38:36.080 回答