anchor.diff:  pagesize(Width, Height) -> {0,0,Width,Height}.
   
   set_pagesize(PID, Size)-> 
  -    PID ! {mediabox, pagesize(Size) }.
  +  gen_server:cast(PID, {mediabox, pagesize(Size) }).
  +
   
   set_pagesize(PID, Width, Height) -> 
  -    PID ! {mediabox, pagesize(Width, Height)} .
  +  gen_server:cast(PID, {mediabox, pagesize(Width, Height) }).
   
   %% -- Fonts --
   
   set_font(PID, Fontname, Size)->
  -    PID ! {font, {set, Fontname, Size}}.
  +    gen_server:cast(PID, {font, {set, Fontname, Size}}).
   
   ensure_font_gets_loaded(PID, FontName) ->
  -    PID ! {ensure_font, FontName}.
  +    gen_server:cast(PID, {ensure_font, FontName}).
   
   
   %% -- This function is a bit expensive, but will stick to the public interface.
  
positive.code: %% Note page 1 is already created  by default and  current page set 
  %% to it after creation of PDF context.
  new_page(PID)->
      PID ! {page, {new, self()}},
      receive
  	{page,PageNo}->
  	    PageNo;
  	{'EXIT', PID, Reason} ->
  	    exit(Reason)
      end.
  
  page_script(PID, Script) ->
      PID ! {page_script, Script}.
  
  %% Go to a page already created.    
  set_page(PID, PageNo)->
      PID ! {page,{set, PageNo}}.
  
  %% Useful for page numbering functions etc.
  get_page_no(PID)->
      PID ! {page, {get_no, self()}},
      receive
  	{page,PageNo}->
  	    PageNo;
  	{'EXIT', PID, Reason} ->
  	    exit(Reason)
      end.
      
  %% --- Info -----
  
  set_author(PID,Author)->
      PID ! {info,{author, Author}}.
  
  set_title(PID,Title)->
      PID ! {info,{title, Title}}.
  
  set_subject(PID,Subject)->
      PID ! {info,{subject, Subject}}.
  
  set_date(PID,Year,Month,Day)->
      PID ! {info,{date, {Year,Month,Day}}}.
  
  set_keywords(PID, Keywords)->
      PID ! {info,{keywords, Keywords}}.
  
  
  %% --- Page ---
  
negative.code: %% Export to PDF file format 
  %% return: {PDFDoc::binary(), PageNo::integer()} | exit(Reason)
  export(PID)->
    case gen_server:call(PID, {export}, infinity) of
    	{export, PDFDoc, PageNo}->
    	    {PDFDoc, PageNo};
    	{'EXIT', PID, Reason} ->
    	    exit(Reason)
    end.
  
  %% clear up - delete pdf building process
  delete(PID)->
      gen_server:terminate(all_done,exit),
      done.
  
  
  